Nagios – monitor interSeptor Temperature and Humidity

Jakarta interSeptor is a server room grade temperature and humidity monitoring device that offers SNMP access:
https://www.jacarta.com/interseptor/

To manually check your temp and humidity run:
temperature:
/usr/local/nagios/libexec/check_snmp -H _interSeptor_IP_ -C _Community_String_ -o .1.3.6.1.4.1.19011.1.3.1.1.3.2.1.3.1
humidity
/usr/local/nagios/libexec//check_snmp -H _interSeptor_IP_ -C _Community_String_ -o .1.3.6.1.4.1.19011.1.3.1.1.3.2.1.5.1

the output will look like this:
SNMP OK – 207 | iso.3.6.1.4.1.19011.1.3.1.1.3.2.1.3.1=207

Please note that all temperature and humidity values are multiplied by ten when retrieved.
Therefore the returned values should be divided by ten once retrieved to attain the actual
reading.

To deal with that problem in the: /usr/local/nagios/libexec/ folder create check_interSeptor.sh file then paste this:

#!/bin/bash
# $1 - hostname
# $2 - SNMP community string
# $3 - oid
# $4 - Header
# temp oid =.1.3.6.1.4.1.19011.1.3.1.1.3.2.1.3.1
# humidity oid = .1.3.6.1.4.1.19011.1.3.1.1.3.2.1.5.1
# oid details: https://www.jacarta.com/wp-content/uploads/interSeptor-Alarm-OIDs.pdf

snmp=$(/usr/local/nagios/libexec/check_snmp -H $1 -C $2 -o $3|cut -b 11-14)
var=$(echo "scale=2; $snmp/10" | bc )
output=$(echo "$4 - $var | $4=$var" )
echo $output

save the file and make it executable then test it:
/usr/local/nagios/libexec/check_interSeptopr.sh _interSeptor_IP_ _Community_String_ .1.3.6.1.4.1.19011.1.3.1.1.3.2.1.5.1 Humidity

Humidity – 42.20 | Humidity=42.20

Now back to Nagios:
in the commands.cfg define command:

define command {
    command_name    check_interSeptor
    command_line    $USER1$/check_interSeptopr.sh $HOSTADDRESS$ $ARG1$ $ARG2$ $ARG3$
}

then define services:

define service{
        use                     generic-service
        host_name               interseptor
        service_description     Temperature
        check_command           check_interSeptor!BVFB2unUAX!.1.3.6.1.4.1.19011.1.3.1.1.3.2.1.3.1!Temperature
        }

define service{
        use                     generic-service
        host_name               interseptor
        service_description     Humidity
        check_command           check_interSeptor!BVFB2unUAX!.1.3.6.1.4.1.19011.1.3.1.1.3.2.1.5.1!Humidity
        }

Nagios core – SNMP – monitor ethernet adapter bandwidth – part 2

Now that SNMP is setup on our Windows and Linux boxes we need to configure Nagios Core to monitor them.

Plugin details – Nagios Exchange

Plugin download – link

On nagios server go to /usr/local/nagios/libexec and download the plugin:

wget http://nagios.manubulon.com/check_snmp_int.pl

then make it executable

chmod +x check_snmp_int.pl

I assume you already have hosts configured so I will skip this step

Define nagios command:

define command{
command_name check_snmp_int
command_line $USER1$/check_snmp_int.pl -H $HOSTADDRESS$ -C community_string -n $ARG1$ $ARG2$
}

Define service:

define service{
use generic-service
host_name YOUR_HOST
service_description eth0
check_command check_snmp_int!VMXNET3!-g -2 -B -M -k -f -w 4,5 -c 10,15
}

NOTES regarding defining service:
1. you have to find out what network adapter you have on your system – the above is for VMXNET3
this is how you do this:

root@nagios:/usr/local/nagios/var# /usr/local/nagios/libexec/check_snmp_int.pl  -H IP_Address -C Community_String -n -v
Alarm at 15 + 5
SNMP v1 login
Filter :
OID : 1.3.6.1.2.1.2.2.1.2.1, Desc : lo
Name : lo, Index : 1
OID : 1.3.6.1.2.1.2.2.1.2.2, Desc : VMware VMXNET3 Ethernet Controller
Name : VMware VMXNET3 Ethernet Controller, Index : 2
lo:UP, VMware VMXNET3 Ethernet Controller:UP:2 UP: OK

in this case the adapter I want is the VMware VMXNET3
2. VMXNET3 is a 64 bit adapter so flags -g -2 are required

Nagios core – SNMP – monitor ethernet adapter bandwidth – part 1

In this part we will configure SNMP on Windows and Linux servers:

Linux (debian/ubuntu) SNMP install and config:

    1. Install required packages
      apt-get install snmpd snmp snmp-mibs-downloader
    2. configure SNMP
      add/change in /etc/snmp/snmpd.conf :
      
      agentAddress udp:161,udp6:161
      rocommunity your_community_string Nagios_Core_server_IP
      
    3. update iptables
      iptables -A INPUT -i eth0 -p udp -s Nagios_Core_server_IP --dport 161:162 -j ACCEPT
      iptables -A OUTPUT -p udp -d Nagios_Core_server_IP --dport 1024:65535 -j ACCEPT

Windows Config:

1. Install and configure snmp with this Powershell script:

Import-Module ServerManager
Install-WindowsFeature -Name 'SNMP-Service','RSAT-SNMP'

# ENTER YOUR CONFIG HERE:
$pollers = @("Nagios_Core_server_IP")
$CommunityStr = @("your_community_string")

#test if SNMP-Service Feature is enabled
$test = Get-WindowsFeature -Name SNMP-Service

#Install/Enable SNMP-Service if it is not enabled
If ($test.Installed -ne "True") {
Write-Host "Enabling SNMP-Service Feature"
Get-WindowsFeature -name SNMP* | Add-WindowsFeature -IncludeManagementTools | Out-Null
}

#re-test if SNMP-Service Feature is enabled and update variable
$test = Get-WindowsFeature -Name SNMP-Service

#Setup reg keys to configure SNMP-Service if Feature is Enabled
If ($test.Installed -eq "True"){
Write-Host "Configuring SNMP-Services with your Community strings and Permitted pollers"
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\SNMP\Parameters\PermittedManagers" /v 1 /t REG_SZ /d localhost /f | Out-Null

Foreach ($String in $CommunityStr){
reg add ("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\SNMP\Parameters\TrapConfiguration\" + $String) /f | Out-Null
reg delete ("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\SNMP\Parameters\TrapConfiguration\" + $String) /ve /f | Out-Null
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\SNMP\Parameters\ValidCommunities" /v $String /t REG_DWORD /d 4 /f | Out-Null
$i = 2

Foreach ($Manager in $pollers){
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\SNMP\Parameters\PermittedManagers" /v $i /t REG_SZ /d $manager /f | Out-Null
reg add ("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\SNMP\Parameters\TrapConfiguration\" + $String) /v $i /t REG_SZ /d $manager /f | Out-Null
$i++
}
}
}