nagiosql_delete_service.php utility to delete single service
Posted: Sat Feb 14, 2015 2:40 pm
The nagiosql_delete_service.php utility does not appear to be working for deletion of a single service.
I execute as follows from the /usr/local/nagios/nagiosxi/scripts directory as the nagios user:
./nagiosql_delete_service.php --id=468
OUTPUT:
URL: http://localhost:8085/nagiosxi/includes/components/ccm/
CMDLINE:
/usr/bin/wget --load-cookies=nagiosql.cookies http://localhost:8085/nagiosxi/includes/components/ccm/ --no-check-certificate --post-data 'type=service&cmd=delete&id=468' -O nagiosql.delete.service
--2015-02-14 19:24:41-- http://localhost:8085/nagiosxi/includes/components/ccm/
Resolving one.proxy.att.com... 135.28.13.11
Connecting to one.proxy.att.com|135.28.13.11|:8080... connected.
Proxy request sent, awaiting response... 407 Proxy Authentication Required
2015-02-14 19:24:41 ERROR 407: Proxy Authentication Required.
1 services deleted successfully!
--------------------------------------------------------------------
I then execute execute reconfigure_nagios.sh. After this completes, I check the GUI for the service and it is still there, even after waiting for a few minutes and logging in and out.
I tried a suggested solution which replaced the following files with http://support.nagios.com/forum/downloa ... hp?id=5439 and http://support.nagios.com/forum/downloa ... hp?id=5430:
delete_object.inc.php
nagiosql_delete_contact.php
nagiosql_delete_host.php
nagiosql_delete_service.php
nagiosql_delete_timeperiod.php
Nothing changed, so I restored the originals.
I realize the document on automated host management doesn't reference the "--id" option, but it did report as successful. How do I delete a single service? I can think of one way, but it would require removing all services for a host, reconfiguring Nagios, and then importing a modified service definition file. This would, I assume, result in the lost of all state and history for the services that were to remain. It would also require a second reconfiguration of Nagios.
I execute as follows from the /usr/local/nagios/nagiosxi/scripts directory as the nagios user:
./nagiosql_delete_service.php --id=468
OUTPUT:
URL: http://localhost:8085/nagiosxi/includes/components/ccm/
CMDLINE:
/usr/bin/wget --load-cookies=nagiosql.cookies http://localhost:8085/nagiosxi/includes/components/ccm/ --no-check-certificate --post-data 'type=service&cmd=delete&id=468' -O nagiosql.delete.service
--2015-02-14 19:24:41-- http://localhost:8085/nagiosxi/includes/components/ccm/
Resolving one.proxy.att.com... 135.28.13.11
Connecting to one.proxy.att.com|135.28.13.11|:8080... connected.
Proxy request sent, awaiting response... 407 Proxy Authentication Required
2015-02-14 19:24:41 ERROR 407: Proxy Authentication Required.
1 services deleted successfully!
--------------------------------------------------------------------
I then execute execute reconfigure_nagios.sh. After this completes, I check the GUI for the service and it is still there, even after waiting for a few minutes and logging in and out.
I tried a suggested solution which replaced the following files with http://support.nagios.com/forum/downloa ... hp?id=5439 and http://support.nagios.com/forum/downloa ... hp?id=5430:
delete_object.inc.php
nagiosql_delete_contact.php
nagiosql_delete_host.php
nagiosql_delete_service.php
nagiosql_delete_timeperiod.php
Nothing changed, so I restored the originals.
I realize the document on automated host management doesn't reference the "--id" option, but it did report as successful. How do I delete a single service? I can think of one way, but it would require removing all services for a host, reconfiguring Nagios, and then importing a modified service definition file. This would, I assume, result in the lost of all state and history for the services that were to remain. It would also require a second reconfiguration of Nagios.