nagios csv question

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.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: nagios csv question

Post 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?
Former Nagios Employee
DiegoAnjos
Posts: 49
Joined: Thu Feb 14, 2013 9:32 am

Re: nagios csv question

Post 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!
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: nagios csv question

Post 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.
Former Nagios employee
DiegoAnjos
Posts: 49
Joined: Thu Feb 14, 2013 9:32 am

Re: nagios csv question

Post by DiegoAnjos »

Hi @tmcdonald

Sorry to hear that...
Thanks for your time!
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: nagios csv question

Post by hsmith »

Are all of your questions regarding this answered?
Former Nagios Employee.
me.
whitest
Posts: 107
Joined: Tue Dec 30, 2014 8:16 am

Re: nagios csv question

Post 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 :(
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: nagios csv question

Post 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.
Former Nagios employee
whitest
Posts: 107
Joined: Tue Dec 30, 2014 8:16 am

Re: nagios csv question

Post 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=
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: nagios csv question

Post 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?
Former Nagios employee
whitest
Posts: 107
Joined: Tue Dec 30, 2014 8:16 am

Re: nagios csv question

Post by whitest »

Lets make the request (export to csv for given hostgroup/servicegroup and All hostgroups/servicegroups) and close the thread.
Thank you.
Locked