1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
|
10/20/2008 -- Nagzilla client/server
01/10/2009 -- Updated
05/26/2009 -- Updated
05/27/2009 -- Updated
07/06/2009 -- Updated
07/26/2009 -- Updated
DISCLAIMER: This is provided AS-IS with no warranty expressed or implied. I nor the company are responsible for anything you do with it so don't expect us to be.
LICENSE: GPL v2. See LICENSE File
Overview:
Nagzilla was designed to be a Jabber relay "bot" in that it sits quietly in a room until it gets a message to relay to either a chatroom or a person. The early work was based on several simple examples out on the internets but didn't quite meet our needs. Namely they would just keep logging into a room every time they had something to say. That forced us to make it a daemon. This also allows us to now get nagzilla alerts from various systems and event creators. Nagzillac (the client program") accepts any string input and makes into a Jabber message. This should work with Google Talk (as it's Jabber based) but
that's not been tested. The only platform this has been tested on is ejabberd running on Ubuntu. I have no doubts it SHOULD work on other Jabber/Linux/Perl platforms as well.
Nagzilla provides some rudimentary security. You have to have your IP address defined in nagzillad.cfg to send messages but on a local LAN spoofing is trivial. You should still use your firewall wisely in this case and allow access only from those clients who should have it.
Installation:
Nagzilla consists of two components nagzillad (the server) and nagzillac (the client). They do not have to live on the same machine at all but require the
same perl modules be installed.
Required Perl Modules:
IO::Socket
IO::Socket::INET
Net::Jabber (Ubuntu package: libnet-jabber-perl)
Config::Simple (Ubuntu package: libconfig-simple-perl)
Data::Dumper (Ubuntu Package: libdata-dumper-simple-perl)
Log::LogLite (Ubuntu package: liblog-loglite-perl)
Getopt::Long
Pod::Usage
Nagzillad Installation
mkdir /etc/nagzillad/
cp nazillad.cfg and nagzillad-config.pl to /etc/nagzillad
cp nagzillad.pl to /usr/local/sbin (or wherever on your system you want it to live)
Edit nagzillad.cfg to suit your needs (file should be self-explanatory)
start nagzillad.pl with & or add an init script (next version?)
Nagzillac Installation
mkdir /etc/nagzillac
cp nagzillac.cfg and nagzillac-config.pl to /etc/nagzillac
cp nagzillac.pl to /usr/local/bin (or wherever on your system you want it to live)
Edit nagzillac.cfg to suit your needs
Make the magic happen:
nagzillac.pl "TYPE^TO^MESSAGE^COLOROFMESSAGE"
TYPE: This can be either 'groupchat' or 'chat' -- groupchat == a chatroom and chat == an individual
TO: What room or person to send to (can be full JID or just a nick with defined jabberserver sent)
MESSAGE: Your message (which should avoid having ^ in it)
COLOROFMESSAGE: Useful for nagios messages, current colors are red, yellow and green -- completely optional
EXAMPLE: nagzillac.pl "groupchat^chatroom^Hi guys a server is down in some far away place^red"
Usage:
Nagzillac connects to and sends messages to nagzillad which relays them to Jabber
Arguments:
-t Type: either groupchat or chat REQUIRED
-r Room: Either chatroom name or JID of an individual REQUIRED
-m Message: The messages you would like to send enclosed in quotes REQUIRED
-c Color: The color of your message (currently only red, yellow and green work) OPTIONAL
-h Prints this message
EXAMPLE: nagzillac2.pl -t groupchat -r chatroom -m "hello server is down" -c red
That's it. Not a bad little hack if you have to monitor stuff and sit in IM all day (or a chat room).
|