## What are Host Check Commands and How do They Work?
Host Check Commands are accessible from the Configuration menu and are used by Opsview Monitor to actively check if a Host is 'UP'.
The Host Check Command can be modified on a host by host basis, as covered in [here](🔗), or it can be changed on multiple Hosts by using the bulk edit functionality covered in [Bulk editing](🔗).
The primary purpose of the Host Check Command is to ensure that the monitored Host is responding, i.e. is considered 'UP' and online. By default, Opsview Monitor ships with 14 Host Check Commands:
tcp port 21 (FTP)
tcp port 22 (SSH)
tcp port 23 (Telnet)
tcp port 25 (SMTP)
tcp port 80 (HTTP)
tcp port 135 (MC RPC)
tcp port 443 (HTTP/SSL)
tcp port 5900 (VNC)
NRPE (on port 5666)
NRPE (on port 5666 ' non-SSL)
tcp port 161 (SNMP)
For example, if ICMP is blocked across the network then using the default Host Check Command of 'Ping' will imply that all Hosts are reported as 'DOWN'. However, SSH may be enabled on the Hosts, or they may be responding on port 80 (if they are web servers). Therefore, changing the Host Check Command on our Hosts to 'tcp port 80 (HTTP)' instead of 'Ping' may allow the Host Check Command to successfully work, and thus all of the Hosts will be correctly reported as 'UP'.
## Adding a Host Check Command
Sometimes the Host Check Commands provided by default in Opsview Monitor are not sufficient for the environment in which it is deployed. To add a new Host Check Command, click on the 'Add New' button:
A 'New Host Check Command' modal will appear. Within this window are three boxes that are user-configurable:
A friendly name for the new Host Check Command. This name will be displayed in the drop-down menus when configuring Hosts.
The plugin to use when executing the Host Check Command.
The arguments to pass to the aforementioned plugin. The Host Check Command comprises of the 'plugin + arguments'.
When the plugin is changed, the 'Plugin Help' text will change based on the help text for the chosen plugin. If the plugin has no help text, then this section will be displayed without any text.
In the example below, we have created a new Host Check Command that checks for a TCP response on port 8080 (in an example scenario of having changed the default Apache2 port to 8080):
Once the new Host Check Command is configured, click 'Submit Changes'. The new Host Check Command will appear in the list of all Host Check Command's and will be highlighted yellow to indicate that you need to go to Configuration > Apply Changes to make the changes live in your production system:
To apply this newly created Host Check Command to one or more Hosts, please follow the guides outlined in [Host Tab](🔗) and [How to bulk edit multiple Hosts](🔗).
## Cloning a Host Check Command
If you want to create a new Host Check Command based on an existing one, click on the contextual menu of the Host Check Command you wish to copy the settings of and select 'Clone'. This will load a 'New Host Check Command' modal with all the pre-populated data of the original Host Check Command:
Provide a new name and different parameters or plugin:
The Host Check Command can be saved via the 'Submit Changes' button. You will also need to go to Configuration > Apply Changes to make the changes live in your production system.
## Deleting a Host Check Command
The deletion of a Host Check Command is done via the contextual menu option 'Delete'. Once 'Delete' is clicked, a modal will load asking you to confirm:
If a Host Check Command is being used by one or more Hosts it cannot be deleted without first re-configuring those Hosts to use a different Host Check Command. A number in the 'Hosts' column indicates if a Host Check Command is in use. This represents the number of different hosts that use this Host Check Command:
To view which hosts use the Host Check Command, click on the number to expand the row and display each Host individually:
To hide the Hosts, re-click the number which will collapse the row back to its original format.
If you attempt to delete a Host Check Command that is being used by one or more Hosts, you will notice that the delete option is greyed out:
To resolve this issue, follow the guides outlined in [Host Tab](🔗) and [How to blk edit Hosts](🔗) to change the Host Check Command for the affected Host(s), and then navigate back to this section to re-attempt the deletion.