1. Lars Hansson
  2. check_monit_service

Overview

HTTPS SSH

About

Nagios plugin for checking the status of monit services.

Configuring

Passive checks

Using passive checks is the best way to use this script. When using passive checks the script connects to the monit host, collects the current status of all configured monit checks and submit the results to Nagios via the command pipe.

Nagios service descriptions must follow the below format.

Process checks:Process: <process>
Filesystem checks:
 Filesystem: <filesystem>
FIFO checks:Fifo: <fifo>
Host checks:Host: <host>
System checks:System: CPU and Memory
Program checks:Program: <program>
File checks:File: <file>
Directory checks:
 Directory: <directory>

Example configuration:

define command {
    command_name  check_monit_services
    command_line  $USER1$/check_monit_service.py -H $HOSTADDRESS$ -P $_HOSTMONITPORT$ -u $_HOSTMONITUSER$ -p $_HOSTMONITPASS$ $_HOSTMONITOPTS$ -f /usr/local/nagios/var/rw/nagios.cmd -n "$HOSTNAME$"
}
define command {
    command_name  freshness_warning
    command_line  $USER1$/check_dummy 1 "No passive check results received for more than 3 minutes"
}

define service {
    use                     default-service
    name                    monit-service
    max_check_attempts      1
    check_interval          1
    service_description     Process: dummy
    check_command           freshness_warning
    check_freshness         1
    freshness_threshold     300
    notifications_enabled   1
    passive_checks_enabled  1
    active_checks_enabled   0
    notification_options    u,c,r
    register                0
}
define service {
    use                  default-service
    name                 check-monit
    service_description  Service: monit
    hostgroup_name       monit-servers
    check_interval       1
    max_check_attempts   1
    check_command        check_monit_services
    register             0
}
define host {
        use         generic-host
        name        default-host
        action_url  http://$HOSTADDRESS$:$_HOSTMONITPORT$/
        _MONITPORT  2812
        _MONITUSER  monit
        _MONITPASS  monit
        _MONITOPTS
        register    0
}

define host {
    use        default-host
    host_name  localhost
    address    127.0.0.1
}
define service {
    use        check-monit
    host_name  localhost
}
define service {
    use                  monit-service
    host_name            localhost
    service_description  Process: inetd
}
define service {
    use                  monit-service
    host_name            localhost
    service_description  Filesystem: root
}