The output I need should be just a number.
See numeber of notifictions in the last 24 hours
See numeber of notifictions in the last 24 hours
Is it possible in Nagios Core or in livestatus to check how many notifications have been sent in the last 24 hours?
The output I need should be just a number.
The output I need should be just a number.
Rob Hassing


Re: See numeber of notifictions in the last 24 hours
You can use the JSON api in core 4 to fetch this data:
The most important part are the start and endtimes:
Code: Select all
http://<ip>/nagios/cgi-bin/archivejson.cgi?query=notificationcount&starttime=-86400&endtime=-0You are welcome to play with the api using the nifty jsonquery.html tool. In core 4 it is located at:-0 is now
-86400 is a day ago
Code: Select all
http://<ip>/nagios/jsonquery.htmlFormer Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Re: See numeber of notifictions in the last 24 hours
It does not seem to work in my installation

Code: Select all
{
"format_version": 0,
"result": {
"query_time": 1412329765000,
"cgi": "archivejson.cgi",
"user": "rhg",
"query": "notificationcount",
"query_status": "beta",
"program_start": 1412325631000,
"last_data_update": 1412329765000,
"type_code": 0,
"type_text": "Success",
"message": ""
},
"data": {
"selectors": {
"starttime": 1412143365000,
"endtime": 1412329765000
},
"count": 0
}
}
Rob Hassing


Re: See numeber of notifictions in the last 24 hours
Can you try running the query as nagiosadmin? Also, there was a number of JSON escaping fixes in 4.0.8 and a few more fixes will be coming in the next release of core. What version are you running?
URL: http://dwpro.net/nagios/cgi-bin/archive ... endtime=-0
URL: http://dwpro.net/nagios/cgi-bin/archive ... endtime=-0
Code: Select all
{
"format_version": 0,
"result": {
"query_time": 1412347850000,
"cgi": "archivejson.cgi",
"user": "nagiosadmin",
"query": "notificationcount",
"query_status": "beta",
"program_start": 1411882453000,
"last_data_update": 1412347850000,
"type_code": 0,
"type_text": "Success",
"message": ""
},
"data": {
"selectors": {
"starttime": 1412261450000,
"endtime": 1412347850000
},
"count": 36
}
}Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Re: See numeber of notifictions in the last 24 hours
It's working now 
There was a authorization problem as you already mentioned.
Thank you very much for your help.
There was a authorization problem as you already mentioned.
Thank you very much for your help.
Code: Select all
{
"format_version": 0,
"result": {
"query_time": 1412586302000,
"cgi": "archivejson.cgi",
"user": "rhg",
"query": "notificationcount",
"query_status": "beta",
"program_start": 1412586295000,
"last_data_update": 1412586300000,
"type_code": 0,
"type_text": "Success",
"message": ""
},
"data": {
"selectors": {
"starttime": 1412399902000,
"endtime": 1412586302000
},
"count": 73
}
}Rob Hassing

