Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

Directory Tree

sqldelete

Rating
0 votes
Favoured:
0
Current Version
1.0
Compatible With
  • Nagios XI
Owner
Hits
4303
Files:
FileDescription
sqldelete.zipSource Code
Nagios CSP

Meet The New Nagios Core Services Platform

Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.

Monitoring Made Magically Better

  • Nagios Core on Overdrive
  • Powerful Monitoring Dashboards
  • Time-Saving Configuration Wizards
  • Open Source Powered Monitoring On Steroids
  • And So Much More!
sqldelete is a C program used to remove multiple Hosts from the Nagios XI server's nagiosql MYSQL database quickly.
sqldelete is a C program used to remove multiple Hosts from the Nagios XI server's nagiosql MYSQL database quickly.

To compile it, a C development environment needs to be installed on the server as well as the mysql-devel package or the mariadb-devel package.

Extract the ZIP file and run make to compile.

USAGE:sqldelete -o -m -u -p

Options :
-o Single Hostname to remove
-f File name of multiple Host names to remove
-m MYSQL server / IP (Required)
-u MYSQL Username (Required)
-p MYSQL Password (Required)
-t MYSQL Database Name (Required)
-d Print Debug information
-r Do not restore configs on error.
-h -? Print this help
-V Print Version


Here is an example command line you would use to delete a single host called somehost. If the host name has a space in it, enclose it in double quotes like this "some host".
./sqldelete -o somehost -m localhost -u root -p nagiosxi -t nagiosql


Here is an example command line you would use to delete multiple hosts.
The hostfile option is a list of hosts you want to remove.
./sqldelete -f hostfile -m localhost -u root -p nagiosxi -t nagiosql

The names of the hosts need to be on a separate line like the example below.

host name
dummy_host
localhost
host1.name
testhost
bad host

Notice that the host names with a space do not require double quotes around the name.

Here is a description of the steps the application takes when executed.

1. It will run a verification of the configurations. If there is an error. It will exit.
2. If the verification is good, it will create a backup.
3. It will go through the host or hosts to remove and build tables of the objects to remove.
4. It will remove all of the objects and run a verification of the new configurations.
5. If good, it will Apply the Configurations and restart the Nagios process.
6. If the configuration does not verify, it will restore the backup and notify you. Unless the -r option is specified. It will not restore the backup and it will not restart Nagios. This allows you to login to the XI GUI and resolve the configuration issue manually.