Page 1 of 1
Pulling Details of Servers details from Nagios database
Posted: Wed Mar 25, 2020 4:50 am
by Raj_Esh
Hello Experts,
Can someone help to get the details (SQL Query) of Servers from nagios DB? Would like to see what all parameters can be pulled out from it?
Thanks,
Rajesh
Re: Pulling Details of Servers details from Nagios database
Posted: Wed Mar 25, 2020 8:00 am
by scottwilkerson
We have an API built-in to Nagios XI for retrieving data, documentation can be found in the software
Help -> API Docs
Re: Pulling Details of Servers details from Nagios database
Posted: Thu Mar 26, 2020 6:16 am
by Raj_Esh
Unfortunately I dont have environment setup. Can you please share me the code of API here or the Steps please?
Re: Pulling Details of Servers details from Nagios database
Posted: Thu Mar 26, 2020 7:06 am
by scottwilkerson
There are over 50 API endpoints with different data in them, I cannot have all of them here, they are documented in the software
Re: Pulling Details of Servers details from Nagios database
Posted: Thu Mar 26, 2020 1:13 pm
by Raj_Esh
Thank you, I was looking to know what all details can Nagios gives us. ( Example: Server hostname, IP, location, etc, ) ALL .
Anyways thank you

Re: Pulling Details of Servers details from Nagios database
Posted: Thu Mar 26, 2020 1:27 pm
by scottwilkerson
Raj_Esh wrote:Thank you, I was looking to know what all details can Nagios gives us. ( Example: Server hostname, IP, location, etc, ) ALL .
Anyways thank you

It basically can only give you what you put in, and then the results of the check commands when they run.
Re: Pulling Details of Servers details from Nagios database
Posted: Thu Mar 26, 2020 1:32 pm
by Raj_Esh
Thanks Scott
I dont have any Nagios installed now so was checking if i get the fields on what all I get to have Demo ( Saying Nagios will have all this details)
So was looking for example field names as mentioned in last post

Re: Pulling Details of Servers details from Nagios database
Posted: Thu Mar 26, 2020 1:54 pm
by scottwilkerson
This is what the results of just one of the 50+ API's look like. You can setup a trial and look at all available options
Code: Select all
{
"recordcount": "12",
"hoststatus": [
{
"@attributes": {
"id": "401"
},
"instance_id": "1",
"host_id": "202",
"name": "tset",
"display_name": "tset",
"address": "127.0.53.53",
"alias": "tset",
"status_update_time": "2015-09-24 02:05:51",
"status_text": "OK - 127.0.53.53: rta 0.021ms, lost 0%",
"status_text_long": "",
"current_state": "0",
"icon_image": "server.png",
"icon_image_alt": "",
"performance_data": "rta=0.021ms;3000.000;5000.000;0; pl=0%;80;100;; rtmax=0.060ms;;;; rtmin=0.011ms;;;;",
"should_be_scheduled": "1",
"check_type": "0",
"last_state_change": "2015-09-22 12:11:41",
"last_hard_state_change": "2015-09-22 12:11:41",
"last_hard_state": "0",
"last_time_up": "2015-09-24 02:05:51",
"last_time_down": "1969-12-31 18:00:00",
"last_time_unreachable": "1969-12-31 18:00:00",
"last_notification": "1969-12-31 18:00:00",
"next_notification": "1969-12-31 18:00:00",
"no_more_notifications": "0",
"acknowledgement_type": "0",
"current_notification_number": "0",
"event_handler_enabled": "1",
"process_performance_data": "1",
"obsess_over_host": "1",
"modified_host_attributes": "0",
"event_handler": "",
"check_command": "check_xi_host_ping!3000.0!80%!5000.0!100%",
"normal_check_interval": "40",
"retry_check_interval": "5",
"check_timeperiod_id": "128",
"has_been_checked": "1",
"current_check_attempt": "1",
"max_check_attempts": "4",
"last_check": "2015-09-24 02:05:51",
"next_check": "2015-09-24 02:45:51",
"state_type": "1",
"notifications_enabled": "0",
"problem_acknowledged": "0",
"passive_checks_enabled": "1",
"active_checks_enabled": "1",
"flap_detection_enabled": "1",
"is_flapping": "0",
"percent_state_change": "0",
"latency": "0",
"execution_time": "0.00226",
"scheduled_downtime_depth": "0"
}
]
}
Re: Pulling Details of Servers details from Nagios database
Posted: Thu Mar 26, 2020 2:12 pm
by Raj_Esh
Awesome..
This is what I was looking for

Thanks, much Appreciated
And sure, I will definitely try other API's as well.
Re: Pulling Details of Servers details from Nagios database
Posted: Thu Mar 26, 2020 2:14 pm
by scottwilkerson
Raj_Esh wrote:Awesome..
This is what I was looking for

Thanks, much Appreciated
And sure, I will definitely try other API's as well.
Sounds good
Locking thread