From 2f64796c64526633dca35b276758554915f6d43f Mon Sep 17 00:00:00 2001 From: Kevin Fenzi Date: Mon, 19 Jan 2015 21:32:52 +0000 Subject: [PATCH] Nuke xmpp stuff --- .../contactgroups/fedora-sysadmin-email.cfg | 2 +- .../files/nagios/contacts/ricky.cfg | 4 +- .../files/nagios/contacts/smooge.cfg | 22 ++--- .../files/nagios/misccommands.cfg | 16 +-- roles/nagios_server/files/plugins/xmppsend.py | 97 ------------------- 5 files changed, 22 insertions(+), 119 deletions(-) delete mode 100644 roles/nagios_server/files/plugins/xmppsend.py diff --git a/roles/nagios_server/files/nagios/contactgroups/fedora-sysadmin-email.cfg b/roles/nagios_server/files/nagios/contactgroups/fedora-sysadmin-email.cfg index 50aec290b2..1ee0804677 100644 --- a/roles/nagios_server/files/nagios/contactgroups/fedora-sysadmin-email.cfg +++ b/roles/nagios_server/files/nagios/contactgroups/fedora-sysadmin-email.cfg @@ -1,5 +1,5 @@ define contactgroup{ contactgroup_name fedora-sysadmin-email alias Fedora Sysadmin Email Contacts - members mmcgrath,ausil,admin,ricky,jcollie,jstanley,smooge,nb,rigeld2,codeblock,smooge_xmpp,hvivani,kevin,puiterwijkp + members mmcgrath,ausil,admin,ricky,jcollie,jstanley,smooge,nb,rigeld2,codeblock,hvivani,kevin,puiterwijkp } diff --git a/roles/nagios_server/files/nagios/contacts/ricky.cfg b/roles/nagios_server/files/nagios/contacts/ricky.cfg index c5c95f888b..56a23367e4 100644 --- a/roles/nagios_server/files/nagios/contacts/ricky.cfg +++ b/roles/nagios_server/files/nagios/contacts/ricky.cfg @@ -5,8 +5,8 @@ define contact{ host_notification_period 24x7 service_notification_options w,u,c,r host_notification_options d,u,r - service_notification_commands notify-by-email,notify-by-ircbot,notify-by-xmpp - host_notification_commands host-notify-by-email,host-notify-by-ircbot,host-notify-by-xmpp + service_notification_commands notify-by-email,notify-by-ircbot + host_notification_commands host-notify-by-email,host-notify-by-ircbot email ricky@rzhou.org } diff --git a/roles/nagios_server/files/nagios/contacts/smooge.cfg b/roles/nagios_server/files/nagios/contacts/smooge.cfg index 99dc7348ac..96de63fca9 100644 --- a/roles/nagios_server/files/nagios/contacts/smooge.cfg +++ b/roles/nagios_server/files/nagios/contacts/smooge.cfg @@ -10,17 +10,17 @@ define contact{ email smooge+notify@gmail.com } -define contact{ - contact_name smooge_xmpp - alias Stephen Smoogen - service_notification_period 24x7 - host_notification_period 24x7 - service_notification_options w,u,c,r - host_notification_options d,u,r - service_notification_commands notify-by-xmpp - host_notification_commands host-notify-by-xmpp - email smooge@gmail.com -} +#define contact{ +# contact_name smooge_xmpp +# alias Stephen Smoogen +# service_notification_period 24x7 +# host_notification_period 24x7 +# service_notification_options w,u,c,r +# host_notification_options d,u,r +# service_notification_commands notify-by-xmpp +# host_notification_commands host-notify-by-xmpp +# email smooge@gmail.com +#} define contact{ contact_name smooge-emergency diff --git a/roles/nagios_server/files/nagios/misccommands.cfg b/roles/nagios_server/files/nagios/misccommands.cfg index 3546713c09..4d38908b7c 100644 --- a/roles/nagios_server/files/nagios/misccommands.cfg +++ b/roles/nagios_server/files/nagios/misccommands.cfg @@ -86,17 +86,17 @@ define command{ } # 'notify-by-xmpp' command definition -define command{ - command_name notify-by-xmpp - command_line /usr/local/bin/xmppsend -a /etc/nagios/private/xmppnagios.ini "Service: $SERVICEDESC$\nHost: $HOSTNAME$\nInfo: $SERVICEOUTPUT$\nDate: $LONGDATETIME$" $CONTACTEMAIL$ - } +#define command{ +# command_name notify-by-xmpp +# command_line /usr/local/bin/xmppsend -a /etc/nagios/private/xmppnagios.ini "Service: $SERVICEDESC$\nHost: $HOSTNAME$\nInfo: $SERVICEOUTPUT$\nDate: $LONGDATETIME$" $CONTACTEMAIL$ +# } # 'host-notify-by-xmpp' command definition -define command{ - command_name host-notify-by-xmpp - command_line /usr/local/bin/xmppsend -a /etc/nagios/private/xmppnagios.ini "Host '$HOSTALIAS$' is $HOSTSTATE$\nInfo: $HOSTOUTPUT$\nDate: $LONGDATETIME$" $CONTACTEMAIL$ - } +#define command{ +# command_name host-notify-by-xmpp +# command_line /usr/local/bin/xmppsend -a /etc/nagios/private/xmppnagios.ini "Host '$HOSTALIAS$' is $HOSTSTATE$\nInfo: $HOSTOUTPUT$\nDate: $LONGDATETIME$" $CONTACTEMAIL$ +# } diff --git a/roles/nagios_server/files/plugins/xmppsend.py b/roles/nagios_server/files/plugins/xmppsend.py deleted file mode 100644 index 5d01c9d8cd..0000000000 --- a/roles/nagios_server/files/plugins/xmppsend.py +++ /dev/null @@ -1,97 +0,0 @@ -#!/usr/bin/python -tt -# skvidal@fedoraproject.org -# gplv2+ - -#nagios definition -## 'host-notify-by-jabber' command definition -#define command{ -# command_name host-notify-by-jabber -# command_line /usr/local/bin/xmppsend -a config.ini "Host '$HOSTALIAS$' is $HOSTSTATE$ - Info : $HOSTOUTPUT$" $CONTACTPAGER$ -# } -# -## 'notify-by-jabber' command definition -#define command{ -# command_name notify-by-jabber -# command_line /usr/local/bin/xmppsend -a config.ini "$NOTIFICATIONTYPE$ $HOSTNAME$ $SERVICED ESC$ $SERVICESTATE$ $SERVICEOUTPUT$ $LONGDATETIME$" $CONTACTPAGER$ -# } -# - -# needs a config file to get username/pass/other info format is: - -#[xmpp_nagios] -#server=jabber.org -#resource=nagios -#port=5222 -#username=yourusername -#password=yourpasssword - -defaults = {'server':'jabber.org', - 'port':'5222', - 'resource':'nagios'} - -# until xmppony is inplace - -import warnings -warnings.simplefilter("ignore") - -import xmpp -from xmpp.protocol import Message - - -from optparse import OptionParser -import ConfigParser -import sys -import os - - -parser = OptionParser() -parser.add_option("-a", dest="authfile", default=None, help="file to retrieve username/password/server/port/resource information from") -opts, args = parser.parse_args() - -conf = ConfigParser.ConfigParser(defaults=defaults) -if not opts.authfile or not os.path.exists(opts.authfile): - print "no config/auth file specified, can't continue" - sys.exit(1) - -conf.read(opts.authfile) -if not conf.has_section('xmpp_nagios') or not conf.has_option('xmpp_nagios', 'username') or not conf.has_option('xmpp_nagios', 'password'): - print "cannot find at least one of: config section 'xmpp_nagios' or username or password" - sys.exit(1) -server = conf.get('xmpp_nagios', 'server') -username = conf.get('xmpp_nagios', 'username') -password = conf.get('xmpp_nagios', 'password') -resource = conf.get('xmpp_nagios', 'resource') -port = conf.get('xmpp_nagios', 'port') - - -if len(args) < 1: - print "xmppsend message [to whom, multiple args]" - sys.exit(1) - -msg = args[0] - -msg = msg.replace('\\n', '\n') - -c = xmpp.Client(server=server, port=port, debug=[]) -con = c.connect() -if not con: - print "Error: could not connect to server: %s:%s" % (c.Server, c.Port) - sys.exit(1) - -auth = c.auth(user=username, password=password, resource=resource) -if not auth: - print "Error: Could not authenticate to server: %s:%s" % (c.Server, c.Port) - sys.exit(1) - -if len(args) < 2: - r = c.getRoster() - for user in r.keys(): - if user == username: - continue - c.send(Message(user, '%s' % msg)) -else: - for user in args[1:]: - c.send(Message(user, '%s' % msg)) - - -