[Nagios-devel] Re: [Nagios-users] Config Storage/Generation
Posted: Wed Dec 11, 2002 10:38 am
This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.
Send mail to [email protected] for more info.
---1744310530-1267351603-1039631890=:900
Content-Type: TEXT/PLAIN; charset=US-ASCII
Russell, I think this request is somewhat impossible because I haven't met
anyone who wants to do the exact same thing with nagios as I. Thus, their
configs are going to be different, and most likely their database will be
different. How will one populate their database? Where will notifications
go? How do you make changes to the db?
Just to make my point, I'll attach the script that runs to pull data out
of my mysql db and generate my nagios configs. It will probably be of
little use to anyone.
1) all notifications are handled by an event handler accept those that
have a notify_email in the db. the event handler writes back to the db
and populates fields such as down_count_* last_down_count_* last_down_*.
2) the db is populated by another script that dumps data from ciscoworks.
this script is somewhat intelligent as it will take care of ip/hostname
changes, password changes, etc.
3) Nagios is only used for checks, all managing/unmanaging of devices,
downtime, etc is handled through a web-based db frontend and commands are
pushed to nagios rw.
4) The event handler checks to see if I device is supposed to be down
(schedled downtime), then sends proper commands to the nagios rw file.
5) cronjob is run every 15 minutes to look at the db and find all devices
that a) are down b) have been down and recovered - but if the device has
gone down and comes back up before the cronjob is run, no notification
will be sent c) devices that have been acknowledged and d) devices that
have downtime or been unmanaged. This way, if 100 devices go down, you
don't get 100 different emails, instead, you get 1 email with info about
100 devices:
myswtich.blah.com DOWN (12/10/2002 10:10:03)
myrouter.blah.com POWERSUPPLY FAIL (12/10/2002 10:10:03)
..
So, what good is it if you have the config generation piece with none of
the other pieces? Prolly not much good at all. I'd share everything, but
there's not enough time in the day to fully document and make everything
so that it would be portable to other locations.. not to mention
supporting what is published.. My advice to you is to spend a day (or
week) designing exactly what you want out of nagios, build a db (you'll
have to rebuild it and add more things later, trust me), then start
coding.
mysql> describe host_table;
+----------------------+---------------------+------+-----+------------+----------------+
| Field | Type | Null | Key | Default |
Extra |
+----------------------+---------------------+------+-----+------------+----------------+
| oid | int(11) | | PRI | NULL |
auto_increment |
| a | tinyint(4) unsigned | | | 0 |
|
| b | tinyint(4) unsigned | | | 0 |
|
| c | tinyint(6) unsigned | | | 0 |
|
| d | tinyint(4) unsigned | | | 0 |
|
| hostname | varchar(40) | | MUL | |
|
| alias | varchar(35) | YES | MUL | NULL |
|
| vlan | varchar(60) | YES | | NULL |
|
| readonly | varchar(12) | YES | | public |
|
| readwrite | varchar(12) | YES | | private |
|
| pw1 | varchar(20) | YES | | NULL |
|
| pw2 | varchar(20) | YES | | NULL |
|
| pw_type | varchar(20) | | | telnet |
|
| device_type | text | YES | | NULL |
|
| device_version | text | YES | | NULL |
|
| to_monitor | tinyint(4) | | | 1 |
|
| notif
...[email truncated]...
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
while the remaining parts are likely unreadable without MIME-aware tools.
Send mail to [email protected] for more info.
---1744310530-1267351603-1039631890=:900
Content-Type: TEXT/PLAIN; charset=US-ASCII
Russell, I think this request is somewhat impossible because I haven't met
anyone who wants to do the exact same thing with nagios as I. Thus, their
configs are going to be different, and most likely their database will be
different. How will one populate their database? Where will notifications
go? How do you make changes to the db?
Just to make my point, I'll attach the script that runs to pull data out
of my mysql db and generate my nagios configs. It will probably be of
little use to anyone.
1) all notifications are handled by an event handler accept those that
have a notify_email in the db. the event handler writes back to the db
and populates fields such as down_count_* last_down_count_* last_down_*.
2) the db is populated by another script that dumps data from ciscoworks.
this script is somewhat intelligent as it will take care of ip/hostname
changes, password changes, etc.
3) Nagios is only used for checks, all managing/unmanaging of devices,
downtime, etc is handled through a web-based db frontend and commands are
pushed to nagios rw.
4) The event handler checks to see if I device is supposed to be down
(schedled downtime), then sends proper commands to the nagios rw file.
5) cronjob is run every 15 minutes to look at the db and find all devices
that a) are down b) have been down and recovered - but if the device has
gone down and comes back up before the cronjob is run, no notification
will be sent c) devices that have been acknowledged and d) devices that
have downtime or been unmanaged. This way, if 100 devices go down, you
don't get 100 different emails, instead, you get 1 email with info about
100 devices:
myswtich.blah.com DOWN (12/10/2002 10:10:03)
myrouter.blah.com POWERSUPPLY FAIL (12/10/2002 10:10:03)
..
So, what good is it if you have the config generation piece with none of
the other pieces? Prolly not much good at all. I'd share everything, but
there's not enough time in the day to fully document and make everything
so that it would be portable to other locations.. not to mention
supporting what is published.. My advice to you is to spend a day (or
week) designing exactly what you want out of nagios, build a db (you'll
have to rebuild it and add more things later, trust me), then start
coding.
mysql> describe host_table;
+----------------------+---------------------+------+-----+------------+----------------+
| Field | Type | Null | Key | Default |
Extra |
+----------------------+---------------------+------+-----+------------+----------------+
| oid | int(11) | | PRI | NULL |
auto_increment |
| a | tinyint(4) unsigned | | | 0 |
|
| b | tinyint(4) unsigned | | | 0 |
|
| c | tinyint(6) unsigned | | | 0 |
|
| d | tinyint(4) unsigned | | | 0 |
|
| hostname | varchar(40) | | MUL | |
|
| alias | varchar(35) | YES | MUL | NULL |
|
| vlan | varchar(60) | YES | | NULL |
|
| readonly | varchar(12) | YES | | public |
|
| readwrite | varchar(12) | YES | | private |
|
| pw1 | varchar(20) | YES | | NULL |
|
| pw2 | varchar(20) | YES | | NULL |
|
| pw_type | varchar(20) | | | telnet |
|
| device_type | text | YES | | NULL |
|
| device_version | text | YES | | NULL |
|
| to_monitor | tinyint(4) | | | 1 |
|
| notif
...[email truncated]...
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]