Nagios Plugins

  • Macros
  • Commands
  • Services
  • Hosts
  • Hostgroups!
  • Examples
  • Plugin API
  • NRPE

Why?

Alerting

Community

Simplicity

Robust

Modular

How?

Macros

(Variables)

  • User defined
  • Host address
  • Arguments

Order of Operations

  • Execute command
  • Run check
  • Report result

Commands

define command {
    command_name    check_mongodb
    command_line    $USER1$/check_mongodb.py -H $HOSTADDRESS$ -A $ARG1$ -W $ARG2$ -C $ARG3$
}

Hosts

define host {
    use         linux-server
    host_name   prd-om-db11.eth1
    alias       prd-om-db11
    hostgroups  mongo_hosts, prd_om_cluster
}

Hostgroups

define hostgroup {
    hostgroup_name      mongo_hosts
    alias               Mongo Hosts
}

define hostgroup {
    hostgroup_name      prd_om_cluster
    alias               Production OM Cluster
}
define hostgroup {
    hostgroup_name      all_hosts
    alias               All OrderGroove Hosts
    hostgroup_members   apache_hosts,mysql_hosts,mongo_hosts,redis_hosts
}

Services

define service {
    use                     generic-service
    hostgroup_name          mongo_hosts
    service_description     Mongo Free Connections
    check_command           check_mongodb!connections!70!80
}

define service {
    use                     generic-service
    hostgroup_name          prd_om_cluster
    service_description     Check cloud_log Collection State
    check_command           check_mongodb_collection!collection_state!mongog!cloud_log
}

Examples

  • check_tcp
  • check_http
  • check_snmp
  • check_mysql_health
  • check_mongodb.py
  • check_redis.pl
  • check_mariadb_slave.py

Plugin API

  • 0 = OK
  • 1 = WARNING
  • 2 = CRITICAL
  • 3 = UNKNOWN

NRPE

Remote execution is cool but...

There's more...

  • Scheduling
  • Alerting
  • "Perfdata"

References

https://www.nagios.org/documentation

http://nagios.sourceforge.net/docs/3_0/pluginapi.html

Nagios Plugins

By Juan

Nagios Plugins

What is the foundation they are built on? How can we build a plugin?

  • 156