REST API and disabling active and passive checks
-
nortonhealthcare
- Posts: 33
- Joined: Thu Aug 10, 2017 8:22 am
REST API and disabling active and passive checks
Is there a way within the REST API to disable active and passive checks for a host.
Re: REST API and disabling active and passive checks
It can be done, but you would not be modifying the config file. Basically, you would be re-adding (replacing) the host object. Here's a simple example.
I have an existing "test" host, called "MyHost". See the config below:
If I wanted to disable active checks on this host, and enable passive checks, I would run:
The "new" config would be:
I have an existing "test" host, called "MyHost". See the config below:
Code: Select all
define host {
host_name MyHost
use xiwizard_generic_host
address 127.0.0.1
check_command check_dummy!0!!!!!!!
active_checks_enabled 1
passive_checks_enabled 0
register 1
}Code: Select all
[root@main-nagios-xi ~]# curl -XPOST "http://192.168.5.151/nagiosxi/api/v1/config/host?apikey=LTltbjobR0X3V5ViDIitYaI8hjsjoFBaOcWYukamF7oAsD8lhJRvSPWq8I3PjTf7&pretty=1" -d "host_name=MyHost&address=127.0.0.1&check_command=check_dummy\!0\!&use=xiwizard_generic_host&active_checks_enabled=0&passive_checks_enabled=1&force=1&applyconfig=1"
{
"success": "Successfully added MyHost to the system. Config applied, Nagios Core was restarted."
}Code: Select all
define host {
host_name MyHost
use xiwizard_generic_host
address 127.0.0.1
check_command check_dummy!0!
active_checks_enabled 0
passive_checks_enabled 1
register 1
}Be sure to check out our Knowledgebase for helpful articles and solutions!