You can use this feature of our Server Monitoring Agent to send custom metrics to be displayed for this Server Agent in your HetrixTools dashboard.

Requirements:

  • The variables must be stored in the form of a JSON in a file called custom_variables.json
  • This file must be located in the same folder as the agent script and must be readable by the hetrixtools user
  • Example: {"var1":123,"var2":456}
  • Variable names can be 2-32 characters long and contain only alphanumeric characters, spaces, dots, underscores, and hyphens [a-zA-Z0-9 ._-]
  • Values can only be numeric
  • A maximum of 20 custom variables is accepted for each server agent

Use case example:

  • You could create your own script that would record certain metrics on your server; for instance, a script that records the MySQL total connections and failed connections every minute
  • Your script can then record these metrics into the custom_variables.json file, located in the HetrixTools server agent folder
  • Example: {"MySQLTotal":84,"MySQLFails":12}
  • Our agent will then fetch these custom variables from this file every minute and post them to our platform to be displayed in this server agent’s metrics
  • You can run your custom script to refresh the custom variables as often as you’d like, but the HetrixTools agent will only record these metrics once per minute; we recommend running your custom script once per minute as well

Example:

1) A simple bash script to collect the last minute’s HTTP code counts from your Nginx access.log:
https://gist.github.com/hetrixtools/b11cb74770a38d45ea774ebd5ebeec13
(must be placed on a 1-minute cron job)

This feature is only available for Linux Server Monitoring Agent version 2.0.8 or later.