To monitor a new server nagios client (nrpe) and nagios plugins needs to be installed. This instructions are given on a Ubuntu box but should be the same for all Linux/Unix servers.
Following steps will outline how to install them;

Prerequisites

  • root access to the remote Linux/Unix host
  • nagios user account
  • libssl-dev (This is required for SSL connection)
  • xinetd

Installation

  • Create a nagios user with no shell
    useradd -M -s /usr/sbin/nologin nagios
  • Install libssl-dev
    apt-get install libssl-dev
  • install xinetd
    apt-get install xinetd
  • Download Nagios Plugins from http://www.nagios.org/download/ and extract
    wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.16.tar.gz
    tar -xzvf nagios-plugins-1.4.16.tar.gz
    cd nagios-plugins-1.4.16
  • Compile and install the plugins.
    ./configure --with-nagios-user=nagios --with-nagios-group=nagios
    make
    make install
  • Set permissions on the plugin directory
    chown nagios:nagios /usr/local/nagios
    chown -R nagios:nagios /usr/local/nagios/libexec
  • Download NRPE Add-on from http://www.nagios.org/download/ and extract
    wget http://prdownloads.sourceforge.net/sourceforge/nagios/nrpe-2.13.tar.gz
    tar -xzvf nrpe-2.13.tar.gz
    cd nrpe-2.13
  • Compile and install
    ./configure
    make all
    make install-plugin
    make install-daemon
    make install-daemon-config
    make install-xinetd
  • Add monitoring server IP Address to nrpe daemon config
    only_from = 127.0.0.1 <nagios_server_IP_Here>
  • A

  • dd NRPE port to /etc/services file
    nrpe 5666/tcp # NRPE
  • restart xinetd service
    service xinetd restart

Troubleshooting

  • Make sure the nrpe daemon is running under xinetd
    $ netstat -at | grep nrpe
    tcp 0 0 *:nrpe *:* LISTEN
  • Check NRPE daemon is functioning properly
    $ /usr/local/nagios/libexec/check_nrpe -H localhost
    NRPE v2.13
  • Check firewall rules
    $ iptables -I RH-Firewall-1-INPUT -p tcp -m tcp –dport 5666 -j ACCEPT
    $ service iptables save

Issues

Issue 1:

Problem:

Connection refused by host

Solution:

If you are in process of installing the NRPE daemon as an xinetd service for Nagios monitoring capabilities you may run across this error in /var/log/messages.
If you have started xinetd by typing the following:

$ /etc/init.d/xinetd start

but you do not see the NRPE service listening by using netstat:

$ netstat -an | grep 5666

then check /var/log/messages to see if an error similar to the following is in the log file:

xinetd[11497]: service/protocol combination not in /etc/services: nrpe/tcp

If so all you need to do is edit /etc/services and add the following line right above the cvsup entries.

nrpe 5666/tcp # NRPE

After this line is added restart xinetd and verify the 5666 port is now open. You should be good to go.

Issue 2:

Problem:

Zimbra NRPE complains

check_mailq ERROR: is not executable by (uid 0:gid(0 10 6 4 3 2 1 0))
Solution:

Get the path to mailq in zimbra and added to /usr/local/nagios/libexec/utils.pm

$ nano /usr/local/nagios/libexec/utils.pm
$PATH_TO_MAILQ   = "/opt/zimbra/postfix/sbin/mailq";
Advertisements

How do I configure the Internet Protocol version 4 (IPv4) properties of a network connection with a static IP address for servers running Linux operating systems? How do I configure static IP address under Debian Linux or Redhat / RHEL / Fedora / Redhat Enterprise Linux server?
You need to update and/or edit the network configuration files. This tutorial provides procedures to configure a static IP address on a computer running the following operating systems:

  • RHEL / Red hat / Fedora / CentOS Linux eth0 config file – /etc/sysconfig/network-scripts/ifcfg-eth0
  • RHEL / Red hat / Fedora / CentOS Linux eth1 config file – /etc/sysconfig/network-scripts/ifcfg-eth1
  • Debian / Ubuntu Linux – /etc/network/interfaces

Sample Setup: Linux Static TCP/IP Settings
In this example you will use the following Internet Protocol Version 4 (TCP/IPv4) Properties including IP, default gateway, and preferred DNS servers:

  • IP address: 10.1.1.10
  • Netmask: 255.255.255.0
  • Hostname: server1.domain.com
  • Domain: domain.com
  • Gateway IP: 10.1.1.16
  • DNS Server IP # 1: 10.1.1.100
  • DNS Server IP # 2: 10.1.1.99

Update following common files

Entries in /etc/hosts must be in the following format:
IPv4_address hostname alias alias …
where:
IPv4_address must be in the first position
hostname is a fully-qualified domain name and must be in the second position.
aliases are optional and follow the address and hostname entries

$ cat /etc/hosts
127.0.0.1       localhost
10.1.1.10       server1.domain.com  server1.domain.com  server1
 
# The following lines are desirable for IPv6 capable hosts
::1     server1.domain.com server1.domain.com server1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
$ cat /etc/hostname
server1.domain.com

and run

cat -F /etc/hostname

RHEL / Red hat / Fedora / CentOS Linux Static IP Configuration
For static IP configuration you need to edit the following files using a text editor such as vi. Edit /etc/sysconfig/network as follows, enter:

$ cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=server1.domain.com
GATEWAY=10.1.1.16

Edit /etc/sysconfig/network-scripts/ifcfg-eth0, enter:

$ cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=static
DHCPCLASS=
HWADDR=00:30:48:56:A6:2E
IPADDR=10.1.1.10
NETMASK=255.255.255.0
ONBOOT=yes

Edit /etc/resolv.conf and setup DNS servers, enter

$ cat /etc/resolv.conf
#Sample static IP configurations:
search domain.com
nameserver 10.1.1.100
nameserver 10.1.1.99

Finally, you need to restart the networking service, enter:

$ /etc/init.d/network restart
$ ifconfig eth0
$ route -n
$ ping 10.1.1.16
$ ping google.com

Debian / Ubuntu Linux Static IP Configuration
Edit /etc/hostname, enter:

$ cat /etc/hostname
server1.domain.com

Edit /etc/resolv.conf and setup DNS servers, enter:

  1. When resolvconf is installed
    $ cat /etc/network/interfaces
    iface eth0 inet static
         address 10.1.1.10
         network 10.1.1.0
         netmask 255.255.255.0
         broadcast 10.1.2.255
         gateway 10.1.1.16
         dns-search domain.com
         dns-nameservers 10.1.1.100 10.1.1.99
         # To add routing uncomment following line
         #up route add -net 10.1.2.0 netmask 255.255.255.0 gw 10.1.1.16
  2. When resolvconf is not installed
    $ cat /etc/network/interfaces
    iface eth0 inet static
         address 10.1.1.10
         network 192.168.1.0
         netmask 255.255.255.0
         broadcast 192.168.1.255
         gateway 10.1.1.16
         # To add routing uncomment following line
         #up route add -net 10.1.2.0 netmask 255.255.255.0 gw 10.1.1.16
    
    $ cat /etc/resolv.conf
    search domain.com
    nameserver 10.1.1.100
    nameserver 10.1.1.99

Finally, you need to restart the networking service under Debian / Ubuntu Linux, enter:

$ /etc/init.d/networking restart

Type the following commands to verify your new setup, enter:

$ ifconfig eth0
$ route -n
$ ping 10.1.1.16
$ ping google.com

After attaching the disk run

echo "- - -" > /sys/class/scsi_host/host#/scan
fdisk -l
tail -f /var/log/message

Replace host# with actual value such as host0. You can find scsi_host value using the following command:

ls /sys/class/scsi_host

How Do I Delete a Single Device Called /dev/sdc?
In addition to re-scanning the entire bus, a specific device can be added or existing device deleted using the following command:

# echo 1 > /sys/block/devName/device/delete
# echo 1 > /sys/block/sdc/device/delete

How Do I Add a Single Device Called /dev/sdc?
To add a single device explicitly, use the following syntax:

# echo "scsi add-single-device  <strong>  " > /proc/scsi/scsi

Where,

  • <H> : Host
  • <B> : Bus (Channel)
  • <T> : Target (Id)
  • <L> : LUN numbers

For e.g. add /dev/sdc with host # 0, bus # 0, target # 2, and LUN # 0, enter:

# echo "scsi add-single-device 0 0 2 0">/proc/scsi/scsi
# fdisk -l
# cat /proc/scsi/scsi
I thought posting my gentoo configuration might help somebody else as well to give them a kick start on gentoo
Anyways here are my config files
make.conf

INPUT_DEVICES="keyboard mouse vmmouse"
VIDEO_CARDS="vmware nvidia"
ALSA_CARDS="hda-intel"
LINGUAS="en_GB"
CHOST="i686-pc-linux-gnu"
CFLAGS="-march=prescott -O2 -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"
LDFLAGS="-Wl,-O1"
ACCEPT_KEYWORDS="x86"