Removed host from NAGIOS

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
Nabi
Posts: 18
Joined: Thu Apr 12, 2018 7:13 am

Removed host from NAGIOS

Post 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
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Removed host from NAGIOS

Post 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?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Nabi
Posts: 18
Joined: Thu Apr 12, 2018 7:13 am

Re: Removed host from NAGIOS

Post 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
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Removed host from NAGIOS

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Nabi
Posts: 18
Joined: Thu Apr 12, 2018 7:13 am

Re: Removed host from NAGIOS

Post 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
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Removed host from NAGIOS

Post 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
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Nabi
Posts: 18
Joined: Thu Apr 12, 2018 7:13 am

Re: Removed host from NAGIOS

Post by Nabi »

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

Post 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?
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Nabi
Posts: 18
Joined: Thu Apr 12, 2018 7:13 am

Re: Removed host from NAGIOS

Post 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
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Removed host from NAGIOS

Post by scottwilkerson »

This new files is for XI 5.5.0+, the version you are running is about 4 years old
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked