check_confixxlicense

Last update: March 11, 2019

This is a plugin to monitor the license of a Confixx installation in Nagios. Its written in shell so it should run on almost all Linux/Unix based systems. To be able to use the script, please also check the requirements.

Download

Download check_confixxlicense.sh

check_confixxlicense.sh

2077 downloads so far...

Download plugin and save it in your Nagios/Monitoring plugin folder (usually /usr/lib/nagios/plugins, depends on your distribution). Afterwards adjust the permissions (usually chmod 755).

Version history / Changelog

20100402 Started Script programming
20100403 Small Bugfixes in Output

Requirements

  • The following shell commands must exist and be executable by your Nagios user: mysql, grep, cut
  • The SQL-user must have at least SELECT rights for the table register in database confixx

Definition of the parameters

Parameter Description
-H* Hostname or IP address of Server to check
-P Port on which SQL server listens (defaults to: 3306)
-u* SQL-Username (needs Select Rights on confixx.register)
-p* Password for SQL user
-d Name of Confixx Database (defaults to: confixx)
-w How many days before end of license do you want the warning alert
-c How many days before end of license do you want the critical alert
--help Show help/usage

* mandatory parameter

Usage / running the plugin on the command line

Usage:

./check_confixxlicense.sh -H hostname [-P port] -u user -p password [-d string] [-w warning] [-c critical]

Example 1 without thresholds:

./check_confixxlicense.sh -H confixx.example.com -u nagios -p secret
OK Confixx License still valid for 267 days

Example 2 with thresholds:

./check_confixxlicense.sh -H confixx.example.com -u nagios -p secret -w 365 -c 90
WARNING Confixx License will end in 267 days

Command definition

Command definition in Nagios, Icinga 1.x, Shinken, Naemon

Command definition without thresholds/optional parameters:

# 'check_confixxlicense' command definition
define command{
command_name check_confixxlicense
command_line $USER1$/check_confixxlicense -H $HOSTADDRESS$ -u $ARG1$ -p $ARG2$
}

In the following command definition, the optional parameters (including thresholds) are all stored in $ARG3$:

# 'check_confixxlicense' command definition
define command{
command_name check_confixxlicense
command_line $USER1$/check_confixxlicense -H $HOSTADDRESS$ -u $ARG1$ -p $ARG2$ $ARG3$
}

Command definition in Icinga 2.x

object CheckCommand "check_confixxlicense" {
  import "plugin-check-command"
  command = [ PluginContribDir + "/check_confixxlicense.sh" ]

   arguments = {
      "-H" = {
        value = "$confixx_host$"
      }

      "-P" = {
        value = "$confixx_mysql_port$"
      }

      "-u" = {
        value = "$confixx_mysql_user$"
      }

      "-p" = {
        value = "$confixx_mysql_password$"
      }

      "-d" = {
        value = "$confixx_mysql_database$"
      }

      "-w" = {
        value = "$confixx_warning$"
      }

      "-c" = {
        value = "$confixx_critical$"
      }
  }

  vars.confixx_host = "$address$"
  vars.confixx_mysql_port = "3306"
  vars.confixx_database = "confixx"
  vars.confixx_warning = "30"
  vars.confixx_critical = "0"
}

Service definition

Service definition in Nagios, Icinga 1.x, Shinken, Naemon

In this example the plugin uses the command definition with thresholds as described above. It will connect to the SQL-Server using the database confixx with user nagios and password sqlpassword. The check will send a warning 10 days before end of license and a critical 5 days before end of license.

# Check Confixx License
define service{
use generic-service
host_name myconfixx
service_description Confixx License
check_command check_confixxlicense!nagios!sqlpassword!-d confixx -w 10 -c 5
}

In this example, the disk check happens on myexcluster.in.the.cloud and assumes a 50GB available disk space. There is authentication required to access the cluster statistics so here the login happens with user "read" and password "only".

# Check ElasticSearch Store
define service{
  use generic-service
  host_name myesnode
  service_description ElasticSearch Disk Usage
  check_command check_es_system!myescluster.in.the.cloud!50!disk!-u read -p only
}

Service object definition Icinga 2.x

# Check Confixx License
object Service "Confixx License" {
  import "generic-service"
  host_name = "myconfixx"
  check_command = "check_confixxlicense"
  vars.confixx_database = "confixx"
  vars.confixx_mysql_user = "nagios"
  vars.confixx_mysql_password = "secret"
  vars.confixx_warning = "10"
  vars.confixx_critical = "5"
}

Screenshots

check_confixxlicense OK
check_confixxlicense Warning
check_confixxlicense Critical