The Hyperglance Appliance comes bundled with a script that can automatically create Nagios configuration files based on the topology data in the Hyperglance database. Nagios will then start monitoring those devices and Hyperglance can then overlay the Nagios monitoring data back onto the topology. This enables automatic monitoring of dynamic workloads.

How the script works

  • The script is written in Python can also be run from any device with Python 2 or 3 installed. So it could be run from your own Nagios server or with the bundled installation of Nagios available on the Hyperglance Appliance.
  • It connects to the Hyperglance API and pulls out relevant node details which it uses to create Nagios configuration files.
  • Nagios then starts monitoring these devices.
  • Hyperglance uses its in-built Nagios integration to query Nagios and overlay service data and alarms onto the topology.

Script location
The script is pre-installed on the Hyperglance Appliance in: /etc/hg2nagios/

Getting Started

  1. Create HG API keys 
  • Navigate to hyperglance admin panel https://IP_address:8443/#/admin. Select the 'API' section to create a unique API key via 'Register App'
  • Configure Hyperglance to connect to Nagios API
  • Navigate to hyperglance admin panel https://IP_address:8443/#/admin. Select the 'Nagios' Collector under the 'Collectors' section
  • Enter in to the Nagios IP section and 8090 for the Nagios Port 
  • Configure /etc/hg2nagios/hg2nagios.json
  • "url": "" 
  • datasource - datasource name you created in step 1
  • api_key - API key you created in step 1
  • (A full list of settings can be found below).
  • Configure Nagios templates 
  • Templates are located in: /etc/hg2nagios/templates
  • Run 
  • sudo python /etc/hg2nagios/ 
    (NOTE: if you get an error message stating "ImportError: No module named packages.urllib3.exceptions" run 'sudo pip install requests --upgrade')
  • Check Nagios configs are ok
  • /usr/sbin/nagios -v /etc/nagios/nagios.cfg
  • Restart Nagios
  • sudo service nagios restart

Periodic Refresh
Use a Cron job to run the script on a periodic basis, such as every 30 seconds.

All Settings (hg2nagios.json)

 Property  Type  Description
url string Hyperglance API endpoint, 
string Examples: User name, testuser 
string Example: bdb7a065-7d4b-40e7-a47f-b192c91d52b1 
string Directory configuration files will be written to 
bool Delete all regular files from the configuration directory before generating new configs, so you can ensure no dead hosts left in the directory 
string Directory to read configuration file templates from 
integer Timeout (in seconds) for reading from HG API
array Datasources to generate configuration files for 
* name
string Datasource name, one of Amazon, Docker, Nedi, OpenStack, VMware
* nodes
array Node definitions
* * type
string Hyperglance node type
* * template
string Template file to use, can be either absolute or relative path. If relative, the tool will look in template_dir
* * alias
string Attribute to use for Nagios alias
* * host_name
string Attribute to use for Nagios host_name. By default the script is set to use the Hyperglance UID (__UID__) with underscores substituted for any Nagios Illegal characters. This makes the UID ‘Mostly’ unique and in rare circumstances may cause conflicts.
* * address
string Attribute to use for Nagios IP address

If a topology name contains slashes or whitespace, those will be replaced with underscores.
If host_name is a DNS name (for example, AWS ELB), it’ll be resolved to IP address. If DNS name resolves to multiple IP addresses, the script will create multiple configuration files — one per IP address. In such a case, hostname will be prefixed with letter ‘h’ followed by position of IP address in the list of addresses to generate configs for.