Update status in Nagios Xi
Update status in Nagios Xi
I want to update the status of the service/host (ex. from critical to OK after running a script in the server or want to keep the status as OK all the time)
do we have rest api for that , please help!
Is there any way we can create a new status fro certain service/host?
do we have rest api for that , please help!
Is there any way we can create a new status fro certain service/host?
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Update status in Nagios Xi
Yes you can do this via the API
Help -> API Docs -> System Reference -> system/corecommand
The format of the commands would follow either of these external commands
Services
https://assets.nagios.com/downloads/nag ... and_id=114
Hosts
https://assets.nagios.com/downloads/nag ... and_id=115
Help -> API Docs -> System Reference -> system/corecommand
The format of the commands would follow either of these external commands
Services
https://assets.nagios.com/downloads/nag ... and_id=114
Hosts
https://assets.nagios.com/downloads/nag ... and_id=115
Re: Update status in Nagios Xi
Thanks scottwilkerson for the quick response
Tried system/corecommand and got this response "{"cmd":"PROCESS_SERVICE_CHECK_RESULT;localhost:HTTP;0;nagiosadmin;OK- Everything Looks Great\\n","success":"Command submitted"}"
but it is not reflecting in the service Status of Nagios GUI.
Tried system/corecommand and got this response "{"cmd":"PROCESS_SERVICE_CHECK_RESULT;localhost:HTTP;0;nagiosadmin;OK- Everything Looks Great\\n","success":"Command submitted"}"
but it is not reflecting in the service Status of Nagios GUI.
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Update status in Nagios Xi
I just tested the following on my system
when I go look at HTTP on localhost I see
Code: Select all
[root@localhost nagiosxi]# ccurl -XPOST "http://192.168.5.XXX/nagiosxi/api/v1/system/corecommand?apikey=APIKEY" -d "cmd=PROCESS_SERVICE_CHECK_RESULT;localhost;HTTP;0;OK- Everything Looks Great\n"
{"cmd":"PROCESS_SERVICE_CHECK_RESULT;localhost;HTTP;0;OK- Everything Looks Great\\n","success":"Command submitted"}OK- Everything Looks Great
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Update status in Nagios Xi
It is worth noting that the state will only last until the next check result comes in.
Re: Update status in Nagios Xi
scottwilkerson , it is not working for me.
Do i need to enable any parameter in cfg file.
Do i need to enable any parameter in cfg file.
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Update status in Nagios Xi
You do need the following in the nagios.cfg
Also, you need to make sure you didn't specifically disable passive checks in the service .cfg with the passive_checks_enabled directive
Code: Select all
accept_passive_host_checks=1
accept_passive_service_checks=1Re: change status in Nagios Xi
Hi scottwilkerson,
already
passive_checks_enabled = 1 in file /usr/local/nagios/etc/servicetemplates.cfg
and
accept_passive_host_checks=1
accept_passive_service_checks=1 in file /usr/local/nagios/etc/nagios.cfg
(not able to find service.cfg)
still system/corecommand are not updating status in nagios Gui.
please help!
Thanks in advance
already
passive_checks_enabled = 1 in file /usr/local/nagios/etc/servicetemplates.cfg
and
accept_passive_host_checks=1
accept_passive_service_checks=1 in file /usr/local/nagios/etc/nagios.cfg
(not able to find service.cfg)
still system/corecommand are not updating status in nagios Gui.
please help!
Thanks in advance
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Update status in Nagios Xi
Lets run the following:
While that is running, submit the command again from the API and see if you see any errors of note
Code: Select all
tail -f /usr/local/nagios/var/nagios.logRe: Update status in Nagios Xi
Thanks scottwilkerson ;
it helped, now i am able to update it.
i was not getting it because the order of argument was wrong
Thanks a lot
it helped, now i am able to update it.
i was not getting it because the order of argument was wrong
Thanks a lot