Contacts Report
Contacts Report
How can I generate an easy-to-read list of all contacts and what each contact gets notified for? My bosses can't read .cfg files and have requested this information. Thanks.
Re: Contacts Report
I just scratched out a bash one liner to grep through objects.cache. It may not be what you are looking for, but here it is:
txt
The output would look like:
When I run this, I get a few commands at the top, so you can clean it up a bit more with:
You could add strings as you see fit. For example, you can add the notification period with:
To make it a bit more readable, we will add a sed:
The final output should look like:
Unfortunately, the contact information is saved on a per-object basis, not the other way around. I am sure someone better with sed/awk/grep could write you a one-liner for what you are actually looking for. But here it is , anyways.
Code: Select all
cat /usr/local/nagios/var/objects.cache | grep 'host_name\|service_description\|contacts' > /tmp/contacts.The output would look like:
Code: Select all
host_name ebony
service_description Linux Raid Status checks /proc/mdstat
contacts neboglory
host_name ebony
service_description Web Server Port 80 check
contacts neboglory
host_name gent
service_description / Disk Usage
contacts andy,nagiosadmin,neboglory
Code: Select all
cat /usr/local/nagios/var/objects.cache | grep 'host_name\|service_description\|contacts' |grep -v command_name > /tmp/contacts.txtCode: Select all
cat /usr/local/nagios/var/objects.cache | grep 'host_name\|service_description\|contacts\|notification_period' |grep -v command_name > /tmp/contacts.txtCode: Select all
cat /usr/local/nagios/var/objects.cache | grep 'host_name\|service_description\|contacts\|notification_period' |grep -v command_name | sed 's/host_name/\n/g' > /tmp/contacts.txtCode: Select all
ebony
service_description Linux Raid Status checks /proc/mdstat
contacts neboglory
notification_period 24x7
ebony
service_description Web Server Port 80 check
contacts neboglory
notification_period 24x7
gent
service_description / Disk Usage
contacts andy,nagiosadmin,neboglory
notification_period xi_timeperiod_24x7
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.