From af337a12e6f084556400fa93c71304ad63f1efa6 Mon Sep 17 00:00:00 2001 From: Igor Pashev Date: Fri, 23 Sep 2016 12:41:01 +0300 Subject: Initial commit --- pkgs/icinga2/check_mysql_slave.patch | 41 ++++++++++++++++++++++++++++++++ pkgs/icinga2/default.nix | 45 ++++++++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+) create mode 100644 pkgs/icinga2/check_mysql_slave.patch create mode 100644 pkgs/icinga2/default.nix (limited to 'pkgs/icinga2') diff --git a/pkgs/icinga2/check_mysql_slave.patch b/pkgs/icinga2/check_mysql_slave.patch new file mode 100644 index 0000000..0658a8a --- /dev/null +++ b/pkgs/icinga2/check_mysql_slave.patch @@ -0,0 +1,41 @@ +Index: icinga2-2.4.1/itl/command-plugins.conf +=================================================================== +--- icinga2-2.4.1.orig/itl/command-plugins.conf ++++ icinga2-2.4.1/itl/command-plugins.conf +@@ -1775,6 +1775,36 @@ object CheckCommand "mysql" { + vars.mysql_hostname = "$check_address$" + } + ++object CheckCommand "mysql_slave" { ++ import "plugin-check-command" ++ import "ipv4-or-ipv6" ++ ++ command = [ PluginDir + "/check_mysql_slave" ] ++ ++ arguments = { ++ "-H" = "$mysql_hostname$" ++ "-P" = "$mysql_port$" ++ "-s" = "$mysql_socket$" ++ "-f" = "$mysql_file$" ++ "-g" = "$mysql_group$" ++ "-u" = "$mysql_username$" ++ "-p" = "$mysql_password$" ++ "-N" = "$mysql_connection_name$" ++ "-w" = "$mysql_warning$" ++ "-c" = "$mysql_critical$" ++ "-l" = { ++ set_if = "$mysql_ssl$" ++ } ++ "-C" = "$mysql_cacert$" ++ "-a" = "$mysql_cert$" ++ "-k" = "$mysql_key$" ++ "-D" = "$mysql_cadir$" ++ "-L" = "$mysql_ciphers$" ++ } ++ ++ vars.mysql_hostname = "$check_address$" ++} ++ + object CheckCommand "negate" { + import "plugin-check-command" + diff --git a/pkgs/icinga2/default.nix b/pkgs/icinga2/default.nix new file mode 100644 index 0000000..5429a51 --- /dev/null +++ b/pkgs/icinga2/default.nix @@ -0,0 +1,45 @@ +{ stdenv, fetchurl +, bison, boost, cmake, flex +, libedit, mysql, openssl, yajl +}: + +stdenv.mkDerivation rec { + version = "2.4.10"; + name = "icinga2-${version}"; + + src = fetchurl { + url = "https://github.com/Icinga/icinga2/archive/v${version}.tar.gz"; + sha256 = "0pj2y24kgf17106903lnz9gmp5hb3irhafq8sp22qf1wa0q395n2"; + }; + + buildInputs = [ bison boost cmake flex libedit openssl yajl ]; + + patches = [ + ./check_mysql_slave.patch + ]; + + cmakeFlags = [ + "-DCMAKE_INSTALL_LOCALSTATEDIR=/icinga2" + "-DCMAKE_INSTALL_SYSCONFDIR=/icinga2/etc" # this will need runtime support + "-DICINGA2_COMMAND_GROUP=icingacmd" + "-DICINGA2_GROUP=icinga" + "-DICINGA2_RUNDIR=/run" + "-DICINGA2_USER=icinga" + "-DICINGA2_WITH_PGSQL=OFF" + "-DMYSQL_INCLUDE_DIR=${mysql.lib}/include/mysql" + "-DMYSQL_LIB_DIR=${mysql.lib}/lib" + ]; + + # XXX Without DESTDIR it tries to write to /icinga2 and /run: + installPhase = '' + rm -rf tmp + mkdir -p tmp + make install DESTDIR=$(pwd)/tmp + mv tmp/$out $out + mv tmp/icinga2 $out/icinga2 + rm -rf $out/run + for s in $out/icinga2/etc/icinga2/scripts/* ; do + substituteInPlace $s --replace /usr/bin/printf printf + done + ''; +} -- cgit v1.2.3