About Removing Hosts

In GroundWork Monitor you may need to delete a host or multiple host configurations, delete Cloud Hub associated hosts, or other types of monitored hosts. This page describes how to remove hosts based on the monitoring method used.

Deleting Hosts using Scripts

Sometimes you are adding hosts from sources you can't directly control, or misconfigure and end up with hosts in the database that should not be there. While it's possible to delete these with database queries, the use of foreign keys makes this process risky unless you are an expert. It's much safer to use the API. These scripts allow you to delete hosts by name or regex pattern, or by agentID (a database field that identifies the owner process). They require a login with an admin role user. 

Note about Event History

Deleting hosts removes their event history, so don't do this unless you no longer need this data. Note, it will be archived after 1 day so you can still report on them up to the date before you delete them. If your source for monitoring data for these hosts is still active, they will reappear on the next synchronization cycle, minus their event history. 

Using the delete-groundwork-hosts script

This script removes hosts you specify. The services associated with the host will also be removed in a cascade delete. You can run it on a GroundWork server, or on your workstation. It uses HTTPS to connect to the GroundWork API. 

  1. Download the script: delete-groundwork-hosts.sh
  2. Copy it to your workstation.
  3. Set the file as executable:

    chmod +x delete-groundwork-hosts.sh
    CODE
  4. Run the script and answer the prompts. 

    ./delete-groundwork-hosts.sh
    CODE

Using the delete_by_agentid script

This script will remove all the hosts, services and hostgroups and servicegroups associated with a particular agentID, which is a database field that identifies the "Owner" of a host, or the source of monitoring data for a service. You can find the agentID for TCG sources by looking in the Status tab of the connector under Configuration > Connectors. If the source is another application you created, or the agentID is orphaned by errors or configuration changes, you can find it in the database with a query like this: 

docker-compose exec pg psql -c "select hostname, agentID from host;"
CODE

Once you know the agentID you want to remove, you can use this script to remove it.

  1. Download the script: delete_by_agentid.sh
  2. Copy it to your workstation.
  3. Set the file as executable:

    chmod +x delete_by_agentid.sh
    CODE
  4. Run the script and answer the prompts. 

    ./delete_by_agentid.sh
    CODE

Deleting Nagios Configured Hosts

Like all Nagios configuration changes, you will need to perform a Commit operation, (Configuration > Nagios Monitoring > Control > Pre flight test > Commit), to complete the task of removing a host or hosts.

Delete one host

  1. Go to Configuration > Nagios MonitoringHosts > Hosts.
  2. Locate the host you want to delete and select Detail.
  3. Scroll down to the bottom of the Manage Host screen and click Delete.

Delete multiple hosts

There is an easy way to delete one, many, or all hosts. The Delete hosts tool completely removes a host, its associated services, and any reference such a a membership in host groups, service groups, groups, and profiles.

  1. Go to Configuration > Nagios Monitoring > Hosts.
  2. Select Delete hosts.
  3. Next, in the Delete Hosts screen, using the drop-down box, select from the list of abbreviated host names and host addresses.
    • For example, selecting " * " lists all hosts, and " 1* " will list all hosts with an IP address that starts with the number 1.
  4. Once a host abbreviation is chosen the matching hosts will be listed. Select the check box next to each host to be removed.
  5. Select Delete.

    If you select the " * " filter to list all hosts and select Check All to remove all hosts, the system will consider this action as an invalid configuration with no hosts and services. This should be avoided.

Deleting Cloud Hub Hosts

Cloud Hub instances are the hosts that have been setup using the GroundWork Cloud Hub monitoring subsystem. Cloud Hub configuration, using hypervisors and or virtualization manager(s), performs various functions including auto discovery, creating of hosts and host groups, and applying of profiles. Completely removing previously set environments in Cloud Hub includes a command line entry, which is outlined below.

Over license limit

It is recommended to check your license limit prior to configuring Cloud Hub connections. If you need to delete Cloud Hub connectors and can't log in to GroundWork Monitor to do so because the addition of connectors created enough hosts to exceed your license hard limit, please see Cloud Hub Troubleshooting.

Stop monitoring and keep configuration

If you decide you do not want to monitor a particular region but you want to keep the configuration, simply:

  1. Navigate to Configuration > Cloud Hub.
  2. Select STOP for the corresponding connection. The connection, as previously configured, can be started again by selecting START.

Completely delete a configuration

To completely DELETE a specific region's monitored hosts follow the steps below. All of the created host groups and the discovered and monitored instances for that region will be deleted from the Foundation database within a few minutes and monitoring access to the region endpoint will cease.

  1. As an Administrator, go to ConfigurationCloud Hub.
  2. Select STOP and DELETE for each connection to be deleted.

Deleting GDMA Hosts

To remove GDMA hosts from being monitored in GroundWork Monitor you need to uninstall the agent on the client server.

Like all Nagios configuration changes, you will need to perform a Commit operation, (Configuration > Nagios Monitoring > Control > Pre flight test > Commit), to complete the task of removing a host or hosts.

Uninstall GDMA for Linux

  1. Access a command line interface for the Linux GDMA client server.
  2. Backup any custom plugins in the /usr/local/groundwork directory structure. You will need to move these to the new location.
  3. Next, as root user, run the following script to uninstall the agent:

    /usr/local/groundwork/uninstall
    CODE
  4. You will be prompted with the question Do you want to uninstall GroundWork Distributed Monitoring Agent and all of its modules?, confirm the uninstall.

  5. Remove the groundwork sub-directory and all sub-directories:

    rm -rf /usr/local/groundwork
    CODE
  6. On the GroundWork server delete the GDMA client host within the Auto Registration host group, (Configuration > Nagios Monitoring > Hosts > Hosts > Auto-Registration > <hostname> > Detail > delete).

Uninstall GDMA for Windows

  1. Access the File Manager for the Windows GDMA client server.
  2. Backup any custom plugins in the C:\Program Files (x86)\groundwork directory structure. You will need to move these to the new location.
  3. Next, from the C:\Program Files (x86)\groundwork directory, select and run the uninstall.exe file. You will be prompted with the question Do you want to uninstall GroundWork Distributed Monitoring Agent and all of its modules?, answer Yes to uninstall and proceed.
  4. Using the File Manager remove the groundwork directory all all sub-directories.
  5. On the GroundWork server delete the GDMA client host within the Auto Registration host group.

Deleting WMI NRPE_NT Hosts

  1. On the Windows WMI client server, launch the Command Prompt and check if the NRPE_NT directory exists in the C: directory.
  2. If the directory exists stop the service:

    net stop nrpe_nt
    CODE
  3. Then uninstall the service:

    \nrpe_nt\bin\nrpe_nt.exe -u
    CODE
  4. Next, navigate to Computer > Local Disk (C\:) > and delete the NRPE_NT directory.

Related Resources