Hi there,
Since there were some questions about how I combined RackTables with
nagios and bacula, here's a little bit from my efforts in doing this.
Needs to mention that it's customized to our internal structure and
cannot
be taken over into another environment without prior modification :)
- check_back.pl
this is a little script, added as nagios service check, which checks
the
local nagios configuration for hosts and looks into the mysql
table(s) of
one or more systems (bacula and racktables in my case) if they match
any
nagios host. Any host found, that is not found in nagios config, is
reported, so the IT can see if new systems are recorded at
racktables DB
and configured to be backed up.
- check_bacula_clientstatus.pl
This is a nagios check that queries the bacula database for the last
backup made and gives warning and/or critical alarm if the backup is
over
due or failed. It sets a link in the description field which leads
directly to the report page of the bacula-webconsole (bweb).
- check_racktable.pl
This is my check to see if the monitored system is correctly entered
at
the racktables system. It checks the presence of the object, and
queries
the information of it, so it can show within nagios where the object
is
located (e.g. rack location, switch port, uplink switch name, power
connection, etc.). So, if a system goes red, you can directly see
where to
look if you need to go to the machine console. Of course it also
defines a
link in the description field to direcly jump to the corresponding
racktables asset entry.
- generate_configparts.pl
My first creation of auto-generating nagios configuration parts
based on
mysql database queries. This project is quite new and this is the
first
attempt, but more will follow since I find that interesting :)
This script can - based on an array of database configurations -
create
configuration parts for nagios which then can be used in
servicechecks.
It more or less just creates hostgroups with n members in it, based on
sql queries. My current implementation asks bacula for all configured
clients and puts them in a hostgroup backuphosts, which is used in the
servicechecks bacula_clientstatus and bacula_fd to ensure that all
bacula clients are monitored. So I can throw away the mail functions
on
bacula. The second array is fetching hosts (object names) from
racktables
db which have a custom field set. This field is named "Service" which
means these are hosts for which we are managing software updates.
So, when
I set the "Service" field for a specific host to "Premium
Updates" (which
is in sales speak "we cover software updates within 24 hours after
announcement), nagios will automatically put this host in a specific
check, which goes via nrpe to the host and queries the available
updates
(via zypper, portsnap, apt-get, etc.). This could of course easily
expanded to n queries to build a complex auto-generated nagios config
based on n custom fields from racktables db. Oh, and don't forget that
this needs a "cfg_dir=/etc/nagios/config" in nagios.cfg to work :)
Well, so far from me. Hope this helps someone :)
But, as always, no warranty - but it's not great magic... just a
little
perl scripting from an admin which does have automation as hobby :)
Le deagh dhùraghd,
Frank Altpeter
--
FA-RIPE *** http://www.altpeter.de/
| If you fall and break your legs, don't come running to me. -Samuel
| Goldwyn
<
check_back
.pl
>
<
check_bacula_clientstatus
.pl><check_racktable.pl><generate_configparts.pl>