Obtaining Availability Report Data Via API
Posted: Wed Apr 24, 2019 1:58 pm
Hi.
Can you verify our approach on this method to obtain the availability report data via the API?
Are these the API and parameter settings to pull the same content the current CSV extract is gathering for the server availability reporting? It appears that it is running the exact same report, though I would like you to verify and confirm. The start/end times are seconds since the Epoch for the selected time period. We are planning to load this information daily (each day pulls yesterday's info) so we can see the current month trends as well as prior months.
url = (nagios_server + '/nagios/cgi-bin/archivejson.cgi?'+
'query=availability' +
'&availabilityobjecttype=servicegroups' +
'&statetypes=hard'+
'&servicegroup=SLA-Compliance-Server-Availability-Check.TCP-Ping-and-Agent-Activity'+
'&assumeinitialstate=true' +
'&assumestateretention=true' +
'&assumestatesduringnagiosdowntime=true'+
'&assumedinitialhoststate=up' +
'&assumedinitialservicestate=ok' +
'&backtrackedarchives=4'+
'&starttime={}'.format(long(time.mktime(sync_from.timetuple()))) +
'&endtime={}'.format(long(time.mktime(sync_to.timetuple()))))
We built up the info on this URL from the JSON query page: https://ourserver/nagios/jsonquery.html
Thanks!
Can you verify our approach on this method to obtain the availability report data via the API?
Are these the API and parameter settings to pull the same content the current CSV extract is gathering for the server availability reporting? It appears that it is running the exact same report, though I would like you to verify and confirm. The start/end times are seconds since the Epoch for the selected time period. We are planning to load this information daily (each day pulls yesterday's info) so we can see the current month trends as well as prior months.
url = (nagios_server + '/nagios/cgi-bin/archivejson.cgi?'+
'query=availability' +
'&availabilityobjecttype=servicegroups' +
'&statetypes=hard'+
'&servicegroup=SLA-Compliance-Server-Availability-Check.TCP-Ping-and-Agent-Activity'+
'&assumeinitialstate=true' +
'&assumestateretention=true' +
'&assumestatesduringnagiosdowntime=true'+
'&assumedinitialhoststate=up' +
'&assumedinitialservicestate=ok' +
'&backtrackedarchives=4'+
'&starttime={}'.format(long(time.mktime(sync_from.timetuple()))) +
'&endtime={}'.format(long(time.mktime(sync_to.timetuple()))))
We built up the info on this URL from the JSON query page: https://ourserver/nagios/jsonquery.html
Thanks!