Page 1 of 1
Removed host from NAGIOS
Posted: Wed Jul 31, 2019 6:49 am
by Nabi
Hello,
I would like to ask please what is the difference between removing the host from CCM NAGIOS GUI via:
https://nagios_server/nagiosxi/includes/components/ccm/index.php?cmd=view&type=host
and via the command line:
/usr/local/nagiosxi/scripts/nagiosql_delete_host.php --host=$host
/usr/local/nagiosxi/scripts#./reconfigure_nagios.sh
Because If I do it via the CCM GUI then i can see that the host got deleted and the cfg file as well.
While when i do it via the command line i can still see that device exist on the CCM, and the cfg still there as well:
/usr/local/nagios/etc/hosts/host.cfg
Please note that the nagiosql_delete_host.php and reconfigure_nagios.sh does not show any error and all seems fine.
Thanks,
Nabi
Re: Removed host from NAGIOS
Posted: Wed Jul 31, 2019 4:16 pm
by cdienger
There should be no difference. That said, I tested on a 5.6.3 machine where the command is ccm_delete_object.php. Which version are you using? Can you perform an upgrade?
Re: Removed host from NAGIOS
Posted: Thu Aug 01, 2019 2:51 am
by Nabi
I am using NAGIOS XI, this should be the version Nagios XI 2014R2.7
Can we somehow remove bulk of devices at once from the CCM NAGIOS GUI ?
Thanks,
Nabi
Re: Removed host from NAGIOS
Posted: Thu Aug 01, 2019 3:33 pm
by cdienger
Make sure you're deleting the services associated with the host before deleting the host. You cannot delete a host otherwise.
In newer versions of XI you can delete a host and have it delete the services automatically, but this isn't available in 2014 versions so you'll need to delete services from the CCM and then delete the hosts.
Re: Removed host from NAGIOS
Posted: Fri Aug 02, 2019 1:39 am
by Nabi
If i click on the host then on its services then i dont see any service there, so just the host is there, that is why i was able to remove the host easily from the CCM GUI.
I am not sure why i did not have services, but i think the "/usr/local/nagiosxi/scripts/nagiosql_delete_host.php --host=$host" deleted the associated service for the host and kept the host itself for some reason.
However, what i did as workaround I deleted the hosts directly from nagiosql DB, and by this way all was fine ( till now at least

)
So as a for loop i did:
DELETE FROM tbl_host WHERE host_name='$device'" nagiosql
Thanks,
Nabi
Re: Removed host from NAGIOS
Posted: Mon Aug 05, 2019 8:40 am
by scottwilkerson
nagiosql_delete_host.php is depricated in current version of XI, the new file to use for these types of operations (if not using the API) is
Code: Select all
/usr/local/nagiosxi/scripts/ccm_delete_object.php -t host -n "$host"
Code: Select all
/usr/local/nagiosxi/scripts/ccm_delete_object.php -h
Deletes an object (or list of objects) from the CCM database.
Usage: ./ccm_delete_host.php [option] ..
Example: Remove all services from service with config name localhost
./ccm_delete_host.php -t service -c localhost
Usage Options:
-t|--type <type> Object type (host, service, contact, timeperiod)
-i|--id <object id> (OPTIONAL) Object ID
\Host Type Options:
-n|--name <host name> (OPTIONAL) Host name (host type only)
Service Type Options:
-c|--config <config name> (OPTIONAL) Config name to remove all services from (service type only)
Help and Logging:
-h|--help Print out help output
Re: Removed host from NAGIOS
Posted: Mon Aug 05, 2019 8:54 am
by Nabi
Thanks,
If i am missing ccm_delete_object.php from my NAGIOS server, any idea please how to get it?
Thanks,
Re: Removed host from NAGIOS
Posted: Mon Aug 05, 2019 9:11 am
by scottwilkerson
Nabi wrote:Thanks,
If i am missing ccm_delete_object.php from my NAGIOS server, any idea please how to get it?
Thanks,
What version of Nagios XI are you running?
Re: Removed host from NAGIOS
Posted: Mon Aug 05, 2019 9:24 am
by Nabi
scottwilkerson wrote:Nabi wrote:Thanks,
If i am missing ccm_delete_object.php from my NAGIOS server, any idea please how to get it?
Thanks,
What version of Nagios XI are you running?
Nagios XI 2014R2.7
Re: Removed host from NAGIOS
Posted: Mon Aug 05, 2019 9:56 am
by scottwilkerson
This new files is for XI 5.5.0+, the version you are running is about 4 years old