This guide is for our Linux Monitoring Agent, and only if you’re using Service Monitoring on this agent.
If you are monitoring multiple services with our Linux Monitoring Agent, these are stored in the config file /etc/hetrixtools/hetrixtools.cfg
as follows, for example:CheckServices="ssh,php8.1-fpm,mysql"
If you wish to remove a service from being monitored, you’ll need to run the code below.
IMPORTANT: Before running the code below, replace SERVICE_NAME_HERE
with the actual name of the service you wish to remove.
value=$(sed -nE 's/^CheckServices="([^"]*)"/\1/p' /etc/hetrixtools/hetrixtools.cfg | \
awk -F',' '{
for(i=1;i<=NF;i++) if($i != "SERVICE_NAME_HERE") out = (out ? out","$i : $i);
print out
}')
sed -i -E "s/^(CheckServices=\")[^\"]*\"/\1${value}\"/" /etc/hetrixtools/hetrixtools.cfg
Once you run this code, you can then check your configuration file /etc/hetrixtools/hetrixtools.cfg
to see if the desired service has been removed from the configuration file.
IMPORTANT: Before running the same command on multiple or all of your servers, where you wish to remove this service from monitoring, we advise running the command on 1-2 servers first and checking your configuration file (as mentioned above) to make sure that only the desired service has been removed from monitoring.
Let’s say we wish to remove mysql
from our services, the example above, we’ll have to run the following code:
value=$(sed -nE 's/^CheckServices="([^"]*)"/\1/p' /etc/hetrixtools/hetrixtools.cfg | \
awk -F',' '{
for(i=1;i<=NF;i++) if($i != "mysql") out = (out ? out","$i : $i);
print out
}')
sed -i -E "s/^(CheckServices=\")[^\"]*\"/\1${value}\"/" /etc/hetrixtools/hetrixtools.cfg
Then, if we check the agent’s configuration file, /etc/hetrixtools/hetrixtools.cfg
we can see the existing monitored services without mysql
:CheckServices="ssh,php8.1-fpm"
It can then take a few minutes for the monitored service to disappear from your HetrixTools dashboard.