Page 1 of 3
Script to disable monitoring
Posted: Mon Sep 26, 2016 6:27 am
by RIDS_I2MP
Hi Team,
We want to disable monitoring on large number of servers, performing this task one by one for each server will take huge amount of time. So kindly can you let us know if there is any script which can disable monitoring just by passing some arguments.
If such script do not exist then we would like to built a script which fulfills our purpose.
Kindly let us know, what all changes need to be made in configuration files during disabling monitoring on any server and services monitored on it.
Re: Script to disable monitoring
Posted: Mon Sep 26, 2016 9:59 am
by tmcdonald
If you have a list of hosts, services, hostgroups, or servicegroups, this can be automated quite easily:
http://old.nagios.org/developerinfo/ext ... ndlist.php
You will want to look into things like:
Code: Select all
DISABLE_HOSTGROUP_HOST_CHECKS
DISABLE_HOST_CHECK
DISABLE_HOSTGROUP_SVC_CHECKS
etc. as fits your needs.
Re: Script to disable monitoring
Posted: Tue Sep 27, 2016 2:10 am
by RIDS_I2MP
Hi Team,
Below mentioned are inbuilt commands or we need to create them?
DISABLE_HOSTGROUP_HOST_CHECKS
DISABLE_HOST_CHECK
DISABLE_HOSTGROUP_SVC_CHECKS
I am receiving "command not found" as the result
[nagios@eu2napu004 hosts]$ DISABLE_HOST_CHECK;<hostname>
-bash: DISABLE_HOST_CHECK: command not found
-bash: <hostname>: command not found
kindly let me know if mmy understanding is wrong.
Re: Script to disable monitoring
Posted: Tue Sep 27, 2016 8:22 am
by RIDS_I2MP
Hi Team,
After few more analysis on your suggestion I would like to update few things.
I have tried the code for " DISABLE_HOST_CHECK" and it is just disabling the active checks for that host. But my concern is to disable monitoring complete monitoring.
step wise
1. Disable monitoring on services monitored on particular host.
2. Now disable monitoring on host
I went through the list of code present on below link, but could not find anything which can disable monitoring, kindly suggest:
http://old.nagios.org/developerinfo/ext ... egory_id=1
Re: Script to disable monitoring
Posted: Tue Sep 27, 2016 9:39 am
by lmiltchev
In addition to disabling active checks, you could disable passive checks for specific hosts or "program-wide".
http://old.nagios.org/developerinfo/ext ... mand_id=72
http://old.nagios.org/developerinfo/ext ... mand_id=70
Re: Script to disable monitoring
Posted: Wed Sep 28, 2016 9:51 am
by RIDS_I2MP
As per my understanding, this commands will just disable the monitoring temporarily, but we want to completely remove the entry of any particular host from the configuration files and database. Kindly let me if my understanding is wrong.
Also let me know how can I achieve it?
I guess we need to delete the host and service entries from configuration files, I am right?
Kindly also let me know in which file host and service dependencies is mentioned?
Re: Script to disable monitoring
Posted: Wed Sep 28, 2016 10:47 am
by lmiltchev
You don't need to delete the hosts/services that you would like to remove. You can simply deactivate them - services first, then hosts. Under the CCM->Hosts or CCM/Services, click on the "Yes" ("Deactivate" button) under the "Active" column. To make sure the object doesn't have any dependencies, click on the "Relationship Info" button. It will tell you is there is a "Dependent relationship" and if the object can be deleted/deactivated.
If you deactivated your objects, they would not be visible in the GUI. In the future, you can always activate them (if needed).
Re: Script to disable monitoring
Posted: Fri Sep 30, 2016 3:58 am
by RIDS_I2MP
Hi Team,
I am aware of the process of disabling monitoring through GUI, but I need to achieve this process using a script as I want to disable monitoring on large no of servers. So kindly help me to create a shell script to disable monitoring on any particular host.
Please let me know in which
configuration file "host dependent on service" information is present. As I am not able to delete the host until and unless I disable the services which are monitored on that host.
Refer the snapshot attached regarding "host dependent on service":
dependency.PNG
Re: Script to disable monitoring
Posted: Fri Sep 30, 2016 10:31 am
by lmiltchev
According to our developers, there isn't an easy way to do that right now. It is a good candidate for a feature request though. Let me know if you want me to file an internal feature request.
Having said that, it is probably possible to use the REST API from the CLI (GET objects/service), then filter somehow the results (grep, sed, awk, etc.) to get the info you need. This is not going to be "pretty" or easy, and it falls out of the scope of Nagios support.
Re: Script to disable monitoring
Posted: Thu Oct 06, 2016 6:55 am
by RIDS_I2MP
Hi Team,
I am working on the script and succeeded at some extend, kindly let me know what commands are executed when we click on apply configuration?
And also let me know if my below approach is right?
1. Just deleting the hostname entry from the service configuration files present at location /usr/local/nagios/etc/services
2. Then deleting the host configuration file present at location /usr/local/nagios/etc/hosts
3. Then executing the commands for apply configuration
Kindly suggest if my approach is wrong.