Page 1 of 1

Reporting

Posted: Wed Aug 26, 2015 9:26 am
by mkhan12282
Hello

We have nagios configured to send out reports (in PDF format) at the end of every month. However, end user didn't receive last month reports. Though he has received previous months. I can generate reports in nagios GUI but they are within the nagios GUI.

I followed this site and this code to generate report.
http://www.claudiokuenzler.com/blog/117 ... d3BPZeiBJM


wkhtmltopdf --username user1 --password password!T "http://<ip address>/nagios3/cgi-bin/avail.cgi?show_log_entries=&host=HOST&service=SERVICE&timeperiod=thismonth" /tmp/report.pdf

Notice that we have '!T' in the password. If i run the command as above, i get this error.
-bash: !T: event not found

So i put the password in the 'password!T', it generates the report but within the report i don't see the actual data but message as shown attached.
wkhtmltopdf --username user1 --password password!T "http://<ip address>/nagios3/cgi-bin/avail.cgi?show_log_entries=&host=HOST&service=SERVICE&timeperiod=thismonth" /tmp/report.pdf
report.PNG
I would like to generate reports for ALL HOSTS and ALL HOSTGROUPS.
Please assist.
Thank you.
MK

Update-
I did a password change to exclue !T but i get the same output file as previoiusly.

Re: Reporting

Posted: Wed Aug 26, 2015 11:06 am
by hsmith
Is this the only user that you do it for? Have you tried with different users?

Re: Reporting

Posted: Thu Aug 27, 2015 6:10 am
by mkhan12282
Yes, created another user 'mkhan'.
Added this user to the cgi.cfg
restarted apache service, nagios but still see the same output as previously.
Verified that i can access nagios GUI through the new user.


[root@NSV10330 ~]# wkhtmltopdf --username mkhan --password cisco "http://<ip>/nagios/cgi-bin/avail.cgi?show_log_entries=&host=HOST&service=SERVICE&timeperiod=thismonth" /tmp/report.pdf
Loading pages (1/6)
Counting pages (2/6)
Resolving links (4/6)
Loading headers and footers (5/6)
Printing pages (6/6)
Done

Question: How can i change this command line to generate report for ALL HOST and HOSTGROUPS. Wondering, may be we can try it?
Thanks.

Re: Reporting

Posted: Thu Aug 27, 2015 4:07 pm
by jdalrymple
You mean an individual report for each host and service right?

You'll have to blow it up on the command line and run the command for each individual object.

Code: Select all

[jdalrymple@localhost ~]$ grep host_name /usr/local/nagios/var/objects.cache | sort | uniq | awk '{print $2}'
localhost
netapp
Windows10
Windows11
Windows12
Windows13
Windows14
Windows15
Windows16
Windows17
Windows18
Windows19
Windows2
Windows20
Windows21
Windows22
Windows23
Windows24
Windows25
Windows3
Windows4
Windows5
Windows6
Windows7
Windows8
Windows
[jdalrymple@localhost ~]$ grep service_description /usr/local/nagios/var/objects.cache | sort | uniq | awk '{$1=""; print $0}'
 CPU Usage
 Current Load
 Current Users
 Drive C: Disk Usage
 Drive D: Disk Usage
 em0 Bandwidth
 em0 Status
 HTTP
 Memory Usage
 NetApp Uptime
 Page File Usage
 pflog0 Bandwidth
 pflog0 Status
 PING
 Root Partition
 SMTP
 SSH
 Swap Usage
 Total Processes
 Uptime
You'll have to do some of your own munging to get things in order, but create a list then loop through it.

Re: Reporting

Posted: Fri Aug 28, 2015 8:23 am
by mkhan12282
Hi

Thanks for the input.
Not the report through command line.

In my previous comment, i mean can we change some parameter (like ones i have bold) in the following command to generate report for HOSTS and HOSTGROUPS if possible. I really don't know what should i change in the this command to accomplish this.

wkhtmltopdf --username mkhan --password cisco "http://<ip>/nagios/cgi-bin/avail.cgi?show_log_entries=&host=HOST&service=SERVICE&timeperiod=thismonth" /tmp/report.pdf

Regards
MK

Re: Reporting

Posted: Fri Aug 28, 2015 1:43 pm
by tgriep
Try this for hostgroups. Replace NameofHostgroup with a real name of a hostgroup.

Code: Select all

wkhtmltopdf --username mkhan --password cisco "http://<ip>/nagios/cgi-bin/avail.cgi?show_log_entries=&host=HOST&hostgroup=NameofHostgroup&timeperiod=thismonth" /tmp/report.pdf