From e5636a57e7068db4387c18c1729984e8f8649004 Mon Sep 17 00:00:00 2001 From: Doug Bell Date: Tue, 18 Oct 2016 22:41:57 -0500 Subject: [PATCH] start work on distributed monitoring This way, the cpantesters machine can monitor itself and report back to the master for configuration updates and information dumps. --- Rexfile | 28 ++++++++++++++++++++++++++++ etc/monitor/icinga/cpantesters.conf | 27 ++++++++++++++++++++++++++- 2 files changed, 54 insertions(+), 1 deletion(-) diff --git a/Rexfile b/Rexfile index 3eaa6e5..024f053 100644 --- a/Rexfile +++ b/Rexfile @@ -304,6 +304,34 @@ task deploy_monitor => # Needed for php to work on newer OpenBSD # /etc/php-7.0.ini pdo_mysql.so # Load PDO mysql + + ### Distributed monitoring + # http://docs.icinga.org/icinga2/latest/doc/module/icinga2/chapter/distributed-monitoring#distributed-monitoring-automation + # Set up monitor master + run 'icinga2 node setup --master'; + # Cert gets made in /etc/icinga2/pki/ca.crt to copy to client + + # Set up monitor clients + # $ apt-get install icinga2 + # $ icinga2 feature enable api + # $ mkdir -p /etc/icinga2/pki + # $ chown -R icinga:icinga /etc/icinga2/pki + # $ icinga2 pki new-cert --cn \ + # --key /etc/icinga2/pki/.key \ + # --cert /etc/icinga2/pki/.cert + # Copy the trusted master certificate as /etc/icinga2/pki/master.crt + # $ icinga2 pki save-cert --key /etc/icinga2/pki/.key \ + # --cert /etc/icinga2/pki/.crt \ + # --trustedcert /etc/icinga2/pki/master.crt \ + # --host + # $ icinga2 node setup --ticket \ + # --endpoint \ + # --zone \ + # --master_host \ + # --trustedcert /etc/icinga2/pki/master.crt \ + # --accept-config + # $ service icinga2 restart + run 'rcctl restart apache2'; run 'rcctl restart icinga2'; }; diff --git a/etc/monitor/icinga/cpantesters.conf b/etc/monitor/icinga/cpantesters.conf index 83d196a..b48b730 100644 --- a/etc/monitor/icinga/cpantesters.conf +++ b/etc/monitor/icinga/cpantesters.conf @@ -1,6 +1,10 @@ /********************************************************************** - * CPAN Testers monitoring + * CPAN Testers monitoring -- master + * + * This configuration sends out check configs to the clients so they + * can operate independently if the master goes away. + * *********************************************************************/ /*********************************** @@ -19,6 +23,27 @@ object User "doug" { email = "doug@preaction.me" } +/*********************************** + * Zones and Endpoints + **********************************/ + +object Endpoint 'monitor.preaction.me' { + host = '199.38.182.146' +} + +object Endpoint 'cpantesters3.dh.bytemark.co.uk' { + host = '212.110.173.51' +} + +object Zone 'master' { + endpoints = [ 'monitor.preaction.me' ] +} + +object Zone 'clients' { + endpoints = [ 'cpantesters3.dh.bytemark.co.uk' ] + parent = "master" +} + /*********************************** * Hosts **********************************/