Reporting

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
mkhan12282
Posts: 28
Joined: Sun May 31, 2015 3:02 pm

Reporting

Post 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.
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Reporting

Post by hsmith »

Is this the only user that you do it for? Have you tried with different users?
Former Nagios Employee.
me.
mkhan12282
Posts: 28
Joined: Sun May 31, 2015 3:02 pm

Re: Reporting

Post 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.
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: Reporting

Post 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.
mkhan12282
Posts: 28
Joined: Sun May 31, 2015 3:02 pm

Re: Reporting

Post 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
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: Reporting

Post 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
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked