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

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Pres-Gas
Posts: 52
Joined: Thu Mar 22, 2012 12:09 pm

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

Post 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.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

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

Post 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
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

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

Post 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?
Pres-Gas
Posts: 52
Joined: Thu Mar 22, 2012 12:09 pm

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

Post 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
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

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

Post by jdalrymple »

Probably nothing at the moment, let me create a lab environment and see if I can recreate it in-house.
Pres-Gas
Posts: 52
Joined: Thu Mar 22, 2012 12:09 pm

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

Post 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.
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

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

Post 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.
Pres-Gas
Posts: 52
Joined: Thu Mar 22, 2012 12:09 pm

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

Post 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.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

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

Post 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
Be sure to check out our Knowledgebase for helpful articles and solutions!
Pres-Gas
Posts: 52
Joined: Thu Mar 22, 2012 12:09 pm

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

Post 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.
Locked