Welcome to docs.opsview.com

Monitoring an SME-Server

This page has advice on how to setup an SME-Server to be monitored by Opsview 3.

For those who don't know it, this is a cut-down server-only distro based on CentOs (4.7 currently). It uses a very un-canonical templated and web-based config system. The excuse for this is that it works exceedingly well and allows non-Linux admins to admin a Linux machine without much training.

However, this mean that the Opsview CentOS 4.7 agent will not work on it as it does not conform to the templating system. There is an NRPE install for SME-Server but that does not work with Opsview due to the different plugins.

The following procedures are a poor hack and could be tidied considerably; however it achieves the objective of working fine with Opsview. It has been tested on multiple servers in different states (new installs, upgrades…).

Various other methods were tried and this was by far the simplest. Lots of unnecessary and unused stuff is added. However, the advantage of using this approach is that it leverages another maintainer's basic script for nrpe-install on the SME-Server.

We leave that install completely alone (other than a custom nrpe.cfg) and add the Opsview plugins in their usual (Opsview-style) location.

This also means that the SME-specific uninstall will work, and removing the Opsview components is simply down to deleting their install directory.

Being able to remove all of this easily may be necessary for major SME-Server upgrades, which can be confused by add-ons.

To install NRPE for Opsview 3 on an SME-Server host to be monitored

Basic SME NRPE install

Adapted with thanks from documentation by Neddix.com, author of the SME-Server nrpe how-to.

On target:

mkdir working
cd  working
touch wgetall
nano wgetall
  • Create this script:
URL=http://mirror.contribs.org/smeserver/contribs/michaelw/sme7/Nagios3/packages
#URL=http://neddix.com/sme7/Nagios3/packages

F=nagios-nuvola-1.0.3.tar.gz
test ! -f $F && wget -rc -nd $URL/$F

F=nagios-plugins-esx3i-1.0.3-0.el4.noarch.rpm
test ! -f $F && wget -rc -nd $URL/$F

F=dtree_data.js.patch
test ! -f $F && wget -rc -nd $URL/$F

F=nagios-plugins-temptrax-2.0.1-1.el4.rf.i386.rpm
test ! -f $F && wget -rc -nd $URL/$F

F=smeserver-nagios-2.0.0-1.noarch.rpm
test ! -f $F && wget -rc -nd $URL/$F

F=nagios-of-plugins-0.9.4-1.of.noarch.rpm
test ! -f $F && wget -rc -nd $URL/$F

F=nagios-central-config-sample1.tar.gz
test ! -f $F && wget -rc -nd $URL/$F

F=nagios-plugins-generic-1.0.0-0.el4.rf.noarch.rpm
test ! -f $F && wget -rc -nd $URL/$F

F=smeserver-nagios-backup-2.0.0-1.noarch.rpm
test ! -f $F && wget -rc -nd $URL/$F

F=smeserver-nagios-plugins-mysql-2.0.0-1.noarch.rpm
test ! -f $F && wget -rc -nd $URL/$F

F=nrpe.cfg
test ! -f $F && wget -rc -nd $URL/$F

F=smeserver-nagios-nrpe-2.0.0-1.noarch.rpm
test ! -f $F && wget -rc -nd $URL/$F

F=smeserver-nagios-nsca-2.0.0-1.noarch.rpm
test ! -f $F && wget -rc -nd $URL/$F

F=pnp-0.4.12-0.el4.i386.rpm
test ! -f $F && wget -rc -nd $URL/$F

F=nagios-icons-nx-1.0.0.tar.gz
test ! -f $F && wget -rc -nd $URL/$F

F=perl-Nagios-Plugin-0.17-1.rf.noarch.rpm
test ! -f $F && wget -rc -nd $URL/$F
wget -rc -nd $URL/all.md5sum
md5sum -cw all.md5sum
  • Save and do the following to add necessary repositories
bash < wgetall
/sbin/e-smith/db yum_repositories set dag repository \
Name 'Dag - EL4' \
BaseURL 'http://apt.sw.be/redhat/el4/en/$basearch/dag' \
EnableGroups no \
GPGCheck yes \
GPGKey http://dag.wieers.com/packages/RPM-GPG-KEY.dag.txt \
Visible no \
Exclude freetype,htop,iptraf,rsync,syslinux \
status disabled
signal-event yum-modify

Note: on an SME that has been upgraded from <7 might need to prefix the above:

/sbin/e-smith/signal-event yum-modify

here, and similarly with the following commands.

Note: if an error message appears re. another copy of yum running, wait a few moments/minutes and try again.

  • Then:
/usr/bin/yum --enablerepo=dag install \
nagios-plugins \
nagios-plugins-setuid \
perl-Config-Tiny \
perl-Class-Accessor
  • Answer 'y'. Then:
/usr/bin/yum --enablerepo=dag localinstall \
smeserver-nagios-nrpe-*.noarch.rpm \
smeserver-nagios-backup-*.noarch.rpm \
perl-Nagios-Plugin-*.noarch.rpm \
smeserver-nagios-plugins-mysql-*.noarch.rpm \
nagios-plugins-generic-*.noarch.rpm \
nagios-of-plugins-*.noarch.rpm
  • Answer 'y'.

Note: as above, on an SME that has been upgraded from <7 might need to prefix with /sbin/e-smith/…

* Then:

(assuming Opsview server IP is 192.168.mmm.nnn):

config set nrpe service
config setprop nrpe HostsAllow "127.0.0.1 192.168.mmm.nnn"
expand-template /etc/hosts.allow
config setprop nrpe sudoPlugins yes
expand-template /etc/sudoers
service nrpe restart

Note: If the NRPE SME server is behind a firewall you must forward port 5666/tcp to the server

Note: If the SME is not on the local network, you must add the IP address of the the central Opsview to Local Networks in the server-manager).

This completes the basic NRPE install.

Add Opsview plugin libraries

  • The Opsview plugins need to installed. These can be extracted from the Opsview-agent CentOS 4.7 *.rpm (at the time of writing, this was opsview-agent-3.0.1.2126-1.ct4.i386.rpm) available at:

http://downloads.opsview.org/download/get/1669

  • These must be copied to
/usr/local/nagios/libexec/*
  • Then the /etc/nagios/nrpe.cfg needs to be edited.
  • Either edit as necessary, and add the plugins as in List 'A' below or
  • Use the pre-prepared nrpe.cfg below, code block 'B'
  • This can be pasted or the file copied to the server
  • Note: this nrpe.cfg has an allowed_hosts IP set unlike the Opsview default, change this if preferred
  • set ownership and permissions:
chown -R nagios:nagios /usr/local/nagios/
chmod -R 755 (all files in directory)
  • Restart the target nrpe service:
service nrpe restart

Code block 'A'

check_command[check_cluster]=/usr/local/nagios/libexec/check_cluster $ARG1$
check_command[check_disk]=/usr/local/nagios/libexec/check_disk $ARG1$
check_command[check_hpjd]=/usr/local/nagios/libexec/check_hpjd $ARG1$
check_command[check_ide_smart]=/usr/local/nagios/libexec/check_ide_smart $ARG1$
check_command[check_load]=/usr/local/nagios/libexec/check_load $ARG1$
check_command[check_ntp]=/usr/local/nagios/libexec/check_ntp $ARG1$
check_command[check_ntp_peer]=/usr/local/nagios/libexec/check_ntp_peer $ARG1$
check_command[check_ntp_time]=/usr/local/nagios/libexec/check_ntp_time $ARG1$
check_command[check_pgsql]=/usr/local/nagios/libexec/check_pgsql $ARG1$
check_command[check_procs]=/usr/local/nagios/libexec/check_procs $ARG1$
check_command[check_snmp]=/usr/local/nagios/libexec/check_snmp $ARG1$
check_command[check_swap]=/usr/local/nagios/libexec/check_swap $ARG1$
check_command[check_time]=/usr/local/nagios/libexec/check_time $ARG1$
check_command[check_users]=/usr/local/nagios/libexec/check_users $ARG1$
check_command[check_file_age]=/usr/local/nagios/libexec/check_file_age $ARG1$
check_command[check_mailq]=/usr/local/nagios/libexec/check_mailq $ARG1$
check_command[check_dir_age]=/usr/local/nagios/libexec/check_dir_age $ARG1$
check_command[check_memory]=/usr/local/nagios/libexec/check_memory $ARG1$

Code block 'B'

#############################################################################
# Sample NRPE Config File 
# Written by: Ethan Galstad (nagios@nagios.org)
# Modified by JR Stabilys Ltd to support Opsview on SME 7.4 architecture
# 
# Last Modified EG: 02-23-2006
# Last Modified JR: 18 Feb 2009
#
# NOTES:
# This is a sample configuration file for the NRPE daemon.  It needs to be
# located on the remote host that is running the NRPE daemon, not the host
# from which the check_nrpe client is being executed.
#
# JR Notes:
# !!Only tested on SME 7.4!! 
# This is a drop-in replacement for the nrpe.cfg produced by a clean install
# of the Nagios® Core nrpe component for SME by Michael Weinburger, see
# http://www.neddix.com/sme7/MANUALS/Nagios%20NRPE%20-%20SME%20Server.pdf
#
# See 'JR' below for fields that have been changed.
# hosts_allowed will need to be edited as appropriate
#############################################################################
 
 
# PID FILE
# The name of the file in which the NRPE daemon should write it's process ID
# number.  The file is only written if the NRPE daemon is started by the root
# user and is running in standalone mode.
 
pid_file=/var/run/nrpe.pid
 
 
 
# PORT NUMBER
# Port number we should wait for connections on.
# NOTE: This must be a non-priviledged port (i.e. > 1024).
# NOTE: This option is ignored if NRPE is running under either inetd or xinetd
 
server_port=5666
 
 
 
# SERVER ADDRESS
# Address that nrpe should bind to in case there are more than one interface
# and you do not want nrpe to bind on all interfaces.
# NOTE: This option is ignored if NRPE is running under either inetd or xinetd
 
#server_address=192.168.1.1
 
 
 
# NRPE USER
# This determines the effective user that the NRPE daemon should run as.  
# You can either supply a username or a UID.
# 
# NOTE: This option is ignored if NRPE is running under either inetd or xinetd
 
nrpe_user=nagios
 
 
 
# NRPE GROUP
# This determines the effective group that the NRPE daemon should run as.  
# You can either supply a group name or a GID.
# 
# NOTE: This option is ignored if NRPE is running under either inetd or xinetd
 
nrpe_group=nagios
 
 
 
# ALLOWED HOST ADDRESSES
# This is an optional comma-delimited list of IP address or hostnames 
# that are allowed to talk to the NRPE daemon.
#
# Note: The daemon only does rudimentary checking of the client's IP
# address.  I would highly recommend adding entries in your /etc/hosts.allow
# file to allow only the specified host to connect to the port
# you are running this daemon on.
#
# NOTE: This option is ignored if NRPE is running under either inetd or xinetd
# JR Note: edit according to need, internal VPN or external access
 
allowed_hosts=127.0.0.1,192.168.mmm.nnn
 
 
 
# COMMAND ARGUMENT PROCESSING
# This option determines whether or not the NRPE daemon will allow clients
# to specify arguments to commands that are executed.  This option only works
# if the daemon was configured with the --enable-command-args configure script
# option.  
#
# *** ENABLING THIS OPTION IS A SECURITY RISK! *** 
# Read the SECURITY file for information on some of the security implications
# of enabling this variable.
#
# Values: 0=do not allow arguments, 1=allow command arguments
# JR Note: changed to 1 from 0
 
dont_blame_nrpe=1
 
 
 
# COMMAND PREFIX
# This option allows you to prefix all commands with a user-defined string.
# A space is automatically added between the specified prefix string and the
# command line from the command definition.
#
# *** THIS EXAMPLE MAY POSE A POTENTIAL SECURITY RISK, SO USE WITH CAUTION! ***
# Usage scenario: 
# Execute restricted commmands using sudo.  For this to work, you need to add
# the nagios user to your /etc/sudoers.  An example entry for alllowing 
# execution of the plugins from might be:
#
# nagios          ALL=(ALL) NOPASSWD: /usr/lib/nagios/plugins/
#
# This lets the nagios user run all commands in that directory (and only them)
# without asking for a password.  If you do this, make sure you don't give
# random users write access to that directory or its contents!
 
# command_prefix=/usr/bin/sudo 
 
 
 
# DEBUGGING OPTION
# This option determines whether or not debugging messages are logged to the
# syslog facility.
# Values: 0=debugging off, 1=debugging on
 
debug=0
 
 
 
# COMMAND TIMEOUT
# This specifies the maximum number of seconds that the NRPE daemon will
# allow plugins to finish executing before killing them off.
 
command_timeout=60
 
 
 
# WEEK RANDOM SEED OPTION
# This directive allows you to use SSL even if your system does not have
# a /dev/random or /dev/urandom (on purpose or because the necessary patches
# were not applied). The random number generator will be seeded from a file
# which is either a file pointed to by the environment valiable $RANDFILE
# or $HOME/.rnd. If neither exists, the pseudo random number generator will
# be initialized and a warning will be issued.
# Values: 0=only seed from /dev/[u]random, 1=also seed from weak randomness
 
#allow_weak_random_seed=1
 
 
 
# INCLUDE CONFIG FILE
# This directive allows you to include definitions from an external config file.
 
#include=<somefile.cfg>
 
 
 
# INCLUDE CONFIG DIRECTORY
# This directive allows you to include definitions from config files (with a
# .cfg extension) in one or more directories (with recursion).
 
#include_dir=<somedirectory>
#include_dir=<someotherdirectory>
 
 
 
# COMMAND DEFINITIONS
# Command definitions that this daemon will run.  Definitions
# are in the following format:
#
# command[<command_name>]=<command_line>
#
# When the daemon receives a request to return the results of <command_name>
# it will execute the command specified by the <command_line> argument.
#
# Unlike Nagios Core, the command line cannot contain macros - it must be
# typed exactly as it should be executed.
#
# Note: Any plugins that are used in the command lines must reside
# on the machine that this daemon is running on!  The examples below
# assume that you have plugins installed in a /usr/local/nagios/libexec
# directory.  Also note that you will have to modify the definitions below
# to match the argument format the plugins expect.  Remember, these are
# examples only!
 
# The following examples use hardcoded command arguments...
# JR Note: this set uncommented on install, however only check_load checked working with Opsview.
 
#command[check_users]=/usr/lib/nagios/plugins/check_users -w 5 -c 10
#command[check_load]=/usr/lib/nagios/plugins/check_load -w 15,10,5 -c 30,25,20
#command[check_disk1]=/usr/lib/nagios/plugins/check_disk -w 20 -c 10 -p /dev/hda1
#command[check_disk2]=/usr/lib/nagios/plugins/check_disk -w 20 -c 10 -p /dev/hdb1
#command[check_zombie_procs]=/usr/lib/nagios/plugins/check_procs -w 5 -c 10 -s Z
#command[check_total_procs]=/usr/lib/nagios/plugins/check_procs -w 150 -c 200 
 
# The following examples allow user-supplied arguments and can
# only be used if the NRPE daemon was compiled with support for 
# command arguments *AND* the dont_blame_nrpe directive in this
# config file is set to '1'...
 
#command[check_users]=/usr/lib/nagios/plugins/check_users -w $ARG1$ -c $ARG2$
#command[check_load]=/usr/lib/nagios/plugins/check_load -w $ARG1$ -c $ARG2$
#command[check_disk]=/usr/lib/nagios/plugins/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
#command[check_procs]=/usr/lib/nagios/plugins/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$
 
 
# JR Note: the below added from Opsview standard CentOS 4.7 install:
# CentOS 4.7-compiled commands also must be added to /usr/local/nagios/libexec/
 
check_command[check_cluster]=/usr/local/nagios/libexec/check_cluster $ARG1$
check_command[check_disk]=/usr/local/nagios/libexec/check_disk $ARG1$
check_command[check_hpjd]=/usr/local/nagios/libexec/check_hpjd $ARG1$
check_command[check_ide_smart]=/usr/local/nagios/libexec/check_ide_smart $ARG1$
check_command[check_load]=/usr/local/nagios/libexec/check_load $ARG1$
check_command[check_ntp]=/usr/local/nagios/libexec/check_ntp $ARG1$
check_command[check_ntp_peer]=/usr/local/nagios/libexec/check_ntp_peer $ARG1$
check_command[check_ntp_time]=/usr/local/nagios/libexec/check_ntp_time $ARG1$
check_command[check_pgsql]=/usr/local/nagios/libexec/check_pgsql $ARG1$
check_command[check_procs]=/usr/local/nagios/libexec/check_procs $ARG1$
check_command[check_snmp]=/usr/local/nagios/libexec/check_snmp $ARG1$
check_command[check_swap]=/usr/local/nagios/libexec/check_swap $ARG1$
check_command[check_time]=/usr/local/nagios/libexec/check_time $ARG1$
check_command[check_users]=/usr/local/nagios/libexec/check_users $ARG1$
check_command[check_file_age]=/usr/local/nagios/libexec/check_file_age $ARG1$
check_command[check_mailq]=/usr/local/nagios/libexec/check_mailq $ARG1$
check_command[check_dir_age]=/usr/local/nagios/libexec/check_dir_age $ARG1$
check_command[check_memory]=/usr/local/nagios/libexec/check_memory $ARG1

Testing

  • Test the nrpe installation works by running this command on the central Opsview server:

(The SME-Server nrpe install target is /usr/lib/nagios/plugins/check_nrpe -H IPADDRESS, for reference)

/usr/local/nagios/libexec/check_nrpe -H 192.168.mmm.nnn

Response should be “NRPE v2.5.1” or similar.

This means comms are working OK (SSL encrypted).

  • Test the commands are working locally - these to be issued on the Opsview monitored host:
/usr/local/nagios/libexec/check_disk -w 5% -c 2%
/usr/local/nagios/libexec/check_load -w 5,5,5 -c 9,9,9
/usr/local/nagios/libexec/check_memory -w 90 -c 98
/usr/local/nagios/libexec/check_swap -w 5 -c 1
  • If network checks are working but nrpe checks are not, check the nrpe.cfg to see it has been replaced properly and check the service has been restarted.

To uninstall

e.g if conflict with major upgrade:

service nrpe stop
rpm -e \
nagios \
smeserver-nagios-nrpe \
smeserver-nagios-backup \
nagios-plugins-nrpe \
nagios-of-plugins \
nagios-plugins-generic \
nagios-plugins-setuid \
nagios-plugins-temptrax \
perl-Nagios-Plugin \
smeserver-nagios-plugins-mysql

Also (optionally) delete the added nagios plugins in /usr/local/nagios/libexec/

Navigation
Print/export
Toolbox