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
        }

snmpd: error on subcontainer ‘ia_addr’ insert (-1)

On Debian 10 system – syslog is flooded with:

snmpd[6578]: error on subcontainer ‘ia_addr’ insert (-1)
snmpd[6578]: error on subcontainer ‘ia_addr’ insert (-1)
snmpd[6578]: error on subcontainer ‘ia_addr’ insert (-1)
This seems to be a bug and to fix it edit systemd unit file:

# cp /lib/systemd/system/snmpd.service /etc/systemd/system/snmpd.service
# sed -i "s|-Lsd|-LS6d|" /etc/systemd/system/snmpd.service
# systemctl daemon-reload
# systemctl restart snmpd

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++
}
}
}