== Creating a nagios monitor == This page explains how to create a nagios monitor configuration in [wiki:how-to/puppet 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 === projects/puppet/modules/mayfirst/templates/monitor-utils/cron.d/mf-monitor You'll need to add your script to this directory. === Add to utils.pp === puppet/modules/mayfirst/manifests/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 === projects/puppet/modules/mayfirst/files/nagios/nagios3/conf.d/ This code section should look something like this: {{{ define hostgroup { hostgroup_name mailq-servers alias Mail Check Servers } }}} === Define nagios command === puppet/modules/mayfirst/files/nagios/nagios3/commands.cfg 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. projects/puppet/modules/mayfirst/files/nagios/nagios-plugins/plugins/mf-SCRIPT-NAME You can model scripts that already exist to check this. === Finally add the hostgroup to nagios manifest === projects/puppet/modules/mayfirst/manifests/nagios.pp 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'''