Page 2 of 3

Re: nagios csv question

Posted: Wed Nov 11, 2015 3:57 pm
by rkennedy
Can you provide a bit more clarification on what you're looking for in regards to the time? Where are you looking for this 'time' at?

Re: nagios csv question

Posted: Thu Nov 12, 2015 8:53 am
by DiegoAnjos
Hi @rkennedy

The script extracts information as below (I did minor changes to it):

Code: Select all

REQUEST_METHOD="GET" REMOTE_USER="nagiosadmin" QUERY_STRING="show_log_entries=&host=all&timeperiod=lastmonth&reportperiod=workhours&assumeinitialstates=yes&assumestateretention=yes&assumestatesduringnotrunning=yes&includesoftstates=no&initialassumedhoststate=0&initialassumedservicestate=0&backtrack=4&csvoutput=" /usr/local/nagios/sbin/avail.cgi > extract.csv
TIME_UP_UNSCHEDULED
2678400

So you have to split the given number by 60, then by 60 again (just as timeticks results from SNMP queries)
2678400/60/60 = 744 minutes (31 days X 24h per day)

So, I would like to know if is it possible to get results as shown by Nagios availabily report, example: 6d 23h 59m 26s

Thanks!

Re: nagios csv question

Posted: Thu Nov 12, 2015 6:11 pm
by tmcdonald
This isn't built in to Core, you will need to parse this out in a script or use Excel to make the changes.

Re: nagios csv question

Posted: Fri Nov 13, 2015 7:52 am
by DiegoAnjos
Hi @tmcdonald

Sorry to hear that...
Thanks for your time!

Re: nagios csv question

Posted: Fri Nov 13, 2015 10:43 am
by hsmith
Are all of your questions regarding this answered?

Re: nagios csv question

Posted: Fri Sep 16, 2016 8:43 am
by whitest
I have the question. Why export to CSV is available only for *ALL SERVICES* and *ALL HOSTS*? What about SERVICEGROUPS and HOSTGROUPS?
I've found the Patch (https://support.nagios.com/forum/viewto ... 25&p=70886), but the message is trunkated :(

Re: nagios csv question

Posted: Fri Sep 16, 2016 9:36 am
by tmcdonald
That patch almost certainly would not work against a modern version of Core, since that is from 2005.

The simple answer is just that it hasn't been added yet. Maybe nobody officially requested it be added? You can file a feature request here:

https://github.com/NagiosEnterprises/nagioscore/issues

Otherwise if you do not have a GitHub account I can file it on your behalf.

Re: nagios csv question

Posted: Fri Sep 16, 2016 10:25 am
by whitest
Clearly.
Feature request it's long. Easier way is to parse html.
Just Grab needed service-group report and parse it:

Code: Select all

/nagios/cgi-bin/avail.cgi?show_log_entries=&servicegroup=my-service-group&timeperiod=last7days&smon=9&sday=1&syear=2016&shour=0&smin=0&ssec=0&emon=9&eday=16&eyear=2016&ehour=24&emin=0&esec=0&rpttimeperiod=&assumeinitialstates=yes&assumestateretention=yes&assumestatesduringnotrunning=yes&includesoftstates=yes&initialassumedhoststate=0&initialassumedservicestate=0&backtrack=0&csvoutput=

Re: nagios csv question

Posted: Fri Sep 16, 2016 1:25 pm
by tmcdonald
I can still file the request so it's built-in at some point, but if that works for now do you mind if we close this thread?

Re: nagios csv question

Posted: Fri Sep 16, 2016 1:34 pm
by whitest
Lets make the request (export to csv for given hostgroup/servicegroup and All hostgroups/servicegroups) and close the thread.
Thank you.