As mentioned in the
‘Service Checks’ section, ‘Variables’ are covered in great detail within their
relevant User Guide section. However, in essence they act like standard
computer science ‘Variables’, in that you can configure ‘-p %PORT%’ instead of
‘-p 9200’ for an Elasticsearch Service Check’s arguments. The benefit of this
is that by using a Variable instead of hard coding the port, you can apply the Service Check to hyndreds of Hosts and simply add the ‘%PORT%’ variable to the Hosts
who don’t have Elasticsearch on port 9200.
In our example above,
we have added the ‘Database – MySQL’ Host template which requires the
%MYSQLCREDENTIALS% variable to be populated with relevant username/password
This can be
configured at a global level via ‘Settings > Variables >
%MYSQLCREDENTIALS%’, which means any Host that has Service Checks/Host
templates using the %MYSQLCREDENTIALS% variable will use the values set here
(the global ‘defaults’), however if a Host has a different set of credentials you
can choose to add the %MYSQLCREDENTIALS% locally via the ‘Variables’ tab. If
the Variable is added to the Host locally, the values set here are used first.
For the Host in the
screen above, you can choose to override the username/password with the
custom, Host-specific ones by checking the ‘Override username’ and ‘Override
password’ fields, respectively. The ‘Password’ field has been set to an
‘encrypted’ one at the Variable level, which means once the value is overridden
and the ‘Submit changes’ button has been pressed, the value entered cannot be
retrieved – only overwritten.