Version 1 (modified by Ross, 9 years ago) (diff)


Creating a nagios monitor

This page explains how to create a nagios monitor configuration in puppet. You will need to make changes to get the correct configuration for the type of monitoring.

Set up an executable

These files are stored in puppet/modules/mayfirst/files/monitor-utils/ you can find examples of different versions of monitoring scripts there.

Set up a cronjob


You'll need to add your script to this directory.

Add to utils.pp


The code should look something like this, with the correct file from the executable specified.:

  file { "/usr/local/sbin/mf-monitor-mailq":
    source => "puppet:///modules/mayfirst/monitor-utils/mf-monitor-mailq",
    ensure => present,
    mode => 755,
    owner => "root",
    group => "root"

Define hostgroup


This code section should look something like this:

define hostgroup {
  hostgroup_name  mailq-servers
  alias           Mail Check Servers

Define nagios command


Should look like this:

define command{
  command_name    check-upgrade
  command_line    /usr/local/share/nagios/plugins/mf-nagios-check-upgrade '$HOSTNAME$'

Create parsing script

You will also need to create a script that parses the output of the monitoring files.


You can model scripts that already exist to check this.

Finally add the hostgroup to nagios manifest


One example for standard_hostgroups is:

  if ( $include_standard_hostgroups == true ) {
    $standard_hostgroups = [ 'df-servers', 'upgrade-servers', 'mailq-servers' ]
    $assigned_hostgroups = concat($hostgroups, $standard_hostgroups)
  } else {
    $assigned_hostgroups = $hostgroups

This is from 'define m_nagios_host'.

Make sure all executable scripts have execute permissions