Page 1 of 2

Nagios XI 2014R2.7 not able to delete services via cmdline

Posted: Wed Sep 16, 2015 3:23 pm
by Pres-Gas
Hello,

I am running Nagios XI 2014R2.7 on RHEL 6.7 and I have not been able to delete services with the script "./nagiosql_delete_service.php --config=xxx" after cd-ing into "/usr/local/nagiosxi/scripts". It claims it is successful:

Code: Select all

CMDLINE:
/usr/bin/wget --load-cookies=nagiosql.cookies https://localhost/nagiosxi/includes/components/ccm/ --no-check-certificate --post-data 'type=service&cmd=delete&id=4563' -O nagiosql.delete.service
--2015-09-16 15:48:03--  https://localhost/nagiosxi/includes/components/ccm/
Resolving localhost... 127.0.0.1
Connecting to localhost|127.0.0.1|:443... connected.
WARNING: no certificate subject alternative name matches
        requested host name "localhost".
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: "nagiosql.delete.service"

    [ <=>                                                      ] 8,462       --.-K/s   in 0.009s  

2015-09-16 15:48:03 (962 KB/s) - "nagiosql.delete.service" saved [8462]

12 services deleted successfully!
Then the deletion of the host fails:

Code: Select all

URL: https://localhost/nagiosxi/includes/components/ccm/
Unable to delete host xxx. Host has dependent relationships
I did try this via the core configuration manager successfully. However, we are trying to implement some centralized management outside of the web front end. Let me know if there is any extra info you need.

Re: Nagios XI 2014R2.7 not able to delete services via cmdli

Posted: Thu Sep 17, 2015 9:47 am
by ssax
Hi,

The reason that you are unable to delete the host is because it has dependent relationships, as with the XI interface you need to remove all of those dependencies first.

Go into the XI interface and go to Configure > Core Config Manager > Hosts
- Find your host
- Click on the little blue circle with the i in it and it will show you the relationships that you need to remove (or remove the host from) in order to delete it.

Thank you

Re: Nagios XI 2014R2.7 not able to delete services via cmdli

Posted: Thu Sep 17, 2015 9:49 am
by jdalrymple
Pres-Gas wrote:I did try this via the core configuration manager successfully.
So to be very clear you deleted the host in CCM that you were unable to delete at the command line without making any further changes or apply configs?
If so it sounds like we have a bug to chase.
If not could you please recreate the problem then view the existing dependencies by clicking the blue 'i' in the CCM interface?

Re: Nagios XI 2014R2.7 not able to delete services via cmdli

Posted: Fri Sep 18, 2015 2:15 pm
by Pres-Gas
jdalrymple wrote:So to be very clear you deleted the host in CCM that you were unable to delete at the command line without making any further changes or apply configs?
If so it sounds like we have a bug to chase.
If not could you please recreate the problem then view the existing dependencies by clicking the blue 'i' in the CCM interface?
Yes, I was able to remove the service checks and then host from the web interface consistently. The commandline fails as per above. What would you like from us to chase it down?

Thanks,
Robert

Re: Nagios XI 2014R2.7 not able to delete services via cmdli

Posted: Fri Sep 18, 2015 2:22 pm
by jdalrymple
Probably nothing at the moment, let me create a lab environment and see if I can recreate it in-house.

Re: Nagios XI 2014R2.7 not able to delete services via cmdli

Posted: Fri Sep 18, 2015 2:48 pm
by Pres-Gas
jdalrymple wrote:Probably nothing at the moment, let me create a lab environment and see if I can recreate it in-house.
It was intermittent but now seems to be consistent. Nothing has changed in NagiosXI for us (we are at the latest as per earlier post), but we have been updating the OS. Thanks for looking at it.

Re: Nagios XI 2014R2.7 not able to delete services via cmdli

Posted: Mon Sep 21, 2015 10:16 am
by jdalrymple
I can't recreate it. We'll need you to get into a state where you can't delete the host then without deleting via CCM we can maybe take a look at what you have going on.

As an alternative - I suggest if you're doing automation of hosts/service creation/deletion - make use of hostgroups so that you don't end up with any dependencies.

Re: Nagios XI 2014R2.7 not able to delete services via cmdli

Posted: Mon Sep 21, 2015 10:24 am
by Pres-Gas
jdalrymple wrote:I can't recreate it. We'll need you to get into a state where you can't delete the host then without deleting via CCM we can maybe take a look at what you have going on.

As an alternative - I suggest if you're doing automation of hosts/service creation/deletion - make use of hostgroups so that you don't end up with any dependencies.
Dependencies are not the issue at this point in our setup. What info do you need me to send on when I am at this state? Problem is that the deletion of services does say it is successful, but the services are still there.

Re: Nagios XI 2014R2.7 not able to delete services via cmdli

Posted: Mon Sep 21, 2015 4:05 pm
by tgriep
Try running the reconfigure nagios script from the /usr/local/nagiosxi/scripts folder after you delete the services and see if that resolves the issue.

Code: Select all

cd /usr/local/nagiosxi/scripts
./reconfigure_nagios.sh

Re: Nagios XI 2014R2.7 not able to delete services via cmdli

Posted: Thu Oct 01, 2015 11:48 am
by Pres-Gas
This seems to be resolved if i run "reconfigure_nagios.sh" in the beginning before I remove services then hosts. Then I run "reconfigure_nagios.sh" afterwards and it is successful. It is like I have to "prime the pump" first.