Removed host from NAGIOS
Removed host from NAGIOS
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
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
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?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Re: Removed host from NAGIOS
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
Can we somehow remove bulk of devices at once from the CCM NAGIOS GUI ?
Thanks,
Nabi
Re: Removed host from NAGIOS
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.
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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Re: Removed host from NAGIOS
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
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
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Removed host from NAGIOS
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 outputRe: Removed host from NAGIOS
Thanks,
If i am missing ccm_delete_object.php from my NAGIOS server, any idea please how to get it?
Thanks,
If i am missing ccm_delete_object.php from my NAGIOS server, any idea please how to get it?
Thanks,
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Removed host from NAGIOS
What version of Nagios XI are you running?Nabi wrote: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
scottwilkerson wrote:What version of Nagios XI are you running?Nabi wrote:Thanks,
If i am missing ccm_delete_object.php from my NAGIOS server, any idea please how to get it?
Thanks,
Nagios XI 2014R2.7
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Removed host from NAGIOS
This new files is for XI 5.5.0+, the version you are running is about 4 years old