Temperature Monitoring of HP Switch

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Post Reply
mehmwt
Posts: 6
Joined: Fri Feb 16, 2024 8:09 am

Temperature Monitoring of HP Switch

Post by mehmwt »

Hello,

I am trying to monitor the temperature on HP switch, for this reason i have defined the command and services as follow.

here is the command:

define command {

command_name check_snmp
command_line $USER1$/check_snmp -H 10.176.64.1 -o iso.3.6.1.2.1.99.1.1.1.4.25
}


here is the service:

define service {
use generic-service ; Inherit default values from a template
host_name oswitch00
service_description Temp
check_command check_snmp
}


but on my nagios core interface i have error:

(No output on stdout) stderr:

Moreover, i used this command to see check_snmp works manually or not:

./check_snmp -H 10.176.64.1 -C public -P 2c -o iso.3.6.1.2.1.99.1.1.1.4.25

but this gives me segmentation fault (core Dumped)

i am using nagios core version Nagios Core 4.4.13

Thanks
ssunga
Posts: 49
Joined: Wed Aug 09, 2023 10:38 am

Re: Temperature Monitoring of HP Switch

Post by ssunga »

Hey there, @mehmwt!

Let's walk through some steps together.

Step 1: SNMP Configuration Check
Make sure SNMP is enabled on your HP switch and the community string "public" has the correct permissions.

Step 2: Reinstall `check_snmp` Plugin
Reinstall the plugin to ensure it's not corrupted:

Code: Select all

sudo apt-get install --reinstall nagios-plugins-snmp
or on Centos:

Code: Select all

sudo yum reinstall nagios-plugins-snmp
Step 3: SNMP Tool Validation
Let's see if we can fetch data from the switch using snmpwalk:

Code: Select all

snmpwalk -v2c -c public 10.176.64.1 iso.3.6.1.2.1.99.1.1.1.4.25
If you get a response here, we're on the right track.

Step 4: Update Command Definition
Try updating the Nagios command definition to include the community string and SNMP version:

Code: Select all

define command {
    command_name check_snmp
    command_line $USER1$/check_snmp -H $HOSTADDRESS$ -C public -P 2c -o $ARG1$
}
Step 5: Adjust Service Definition
Update your service definition to pass the OID as an argument:

Code: Select all

define service {
    use generic-service
    host_name oswitch00
    service_description Temp
    check_command check_snmp!iso.3.6.1.2.1.99.1.1.1.4.25
}
Step 6: Manual Command Test
Before we apply changes in Nagios, let's test the command manually to make sure it's working:

Code: Select all

/usr/local/nagios/libexec/check_snmp -H 10.176.64.1 -C public -P 2c -o iso.3.6.1.2.1.99.1.1.1.4.25
Step 7: Enable Debugging
Enable debugging in Nagios by adding to `nagios.cfg`:

Code: Select all

debug_level=32
debug_verbosity=2
Restart Nagios:

Code: Select all

sudo service nagios restart
You can also do

Code: Select all

tail -f /usr/local/nagios/var/nagios.log
To observe nagios logs.

Try these steps and let us know if it resolves the issue!
Post Reply