SNMP CRITICAL - *up(1)*

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.
silentnoise
Posts: 20
Joined: Tue Jun 02, 2020 3:51 pm

SNMP CRITICAL - *up(1)*

Post by silentnoise »

Hi,

i`m new in nagios.
I`m trying to monitor my Home-Network.

In this case i am trying to monitor the upstates of my 8-Port-Switch by 3Com.

In Port 1,7 and 8 is inserted an Cable.
Port 1 is the Uplink
On Port 7 and 8 i?ve plugged 2 Devices.

Only the port 1 is ok.
The rest gives the State "CRITICAL"

Code: Select all

Port 1 Link Status
	
	OK 	05-12-2021 16:36:18 	3d 18h 31m 3s 	1/3 	SNMP OK - up(1) 
	
Port 2 Link Status
	
	CRITICAL 	05-12-2021 16:33:02 	0d 2h 56m 39s 	3/3 	SNMP CRITICAL - *up(1)* 
	
Port 3 Link Status
	
	CRITICAL 	05-12-2021 16:35:30 	3d 16h 56m 25s 	3/3 	SNMP CRITICAL - *up(1)* 
	
Port 4 Link Status
	
	CRITICAL 	05-12-2021 16:36:59 	3d 16h 52m 58s 	3/3 	SNMP CRITICAL - *up(1)* 
	
Port 5 Link Status
	
	CRITICAL 	05-12-2021 16:35:51 	3d 16h 50m 8s 	3/3 	SNMP CRITICAL - *up(1)* 
	
Port 6 Link Status
	
	CRITICAL 	05-12-2021 16:37:16 	3d 16h 47m 33s 	3/3 	SNMP CRITICAL - *up(1)* 
	
Port 7 Link Status
	
	CRITICAL 	05-12-2021 16:37:42 	3d 16h 45m 58s 	3/3 	SNMP CRITICAL - *up(1)* 
	
Port 8 Link Status
	
	CRITICAL 	05-12-2021 16:34:29 	3d 16h 44m 42s 	3/3 	SNMP CRITICAL - *up(1)* 

My Configfile:


define host {

use generic-switch ; Inherit default values from a template
host_name 3-Com-Switch ; The name we're giving to this switch
alias 3-Com-Switch ; A longer name associated with the switch
address 192.168.178.3 ; IP address of the switch
hostgroups switches ; Host groups this switch is associated with
}



define hostgroup {

hostgroup_name switches ; The name of the hostgroup
alias Network Switches ; Long name of the group
}



define service {

use generic-service ; Inherit values from a template
host_name 3-Com-Switch ; The name of the host the service is associated with
service_description PING ; The service description
check_command check_ping!200.0,20%!600.0,60% ; The command used to monitor the service
check_interval 5 ; Check the service every 5 minutes under normal conditions
retry_interval 1 ; Re-check the service every minute until its final/hard state is determined
}



# Monitor uptime via SNMP

define service {

use generic-service ; Inherit values from a template
host_name 3-Com-Switch
service_description Uptime
check_command check_snmp!-C public -o sysUpTime.0
}



# Monitor Port 1 status via SNMP

define service {

use generic-service ; Inherit values from a template
host_name 3-Com-Switch
service_description Port 1 Link Status
check_command check_snmp!-C public -o ifOperStatus.1 -r 1 -m RFC1213-MIB
}

define service {

use generic-service
host_name 3-Com-Switch
service_description Port 2 Link Status
check_command check_snmp!-C public -o ifOperStatus.1 -r 2 -m RFC1213-MIB
}

define service {

use generic-service
host_name 3-Com-Switch
service_description Port 3 Link Status
check_command check_snmp!-C public -o ifOperStatus.1 -r 3 -m RFC1213-MIB
}


define service {

use generic-service
host_name 3-Com-Switch
service_description Port 4 Link Status
check_command check_snmp!-C public -o ifOperStatus.1 -r 4 -m RFC1213-MIB
}

define service {

use generic-service
host_name 3-Com-Switch
service_description Port 5 Link Status
check_command check_snmp!-C public -o ifOperStatus.1 -r 5 -m RFC1213-MIB
}

define service {

use generic-service
host_name 3-Com-Switch
service_description Port 6 Link Status
check_command check_snmp!-C public -o ifOperStatus.1 -r 6 -m RFC1213-MIB
}

define service {

use generic-service
host_name 3-Com-Switch
service_description Port 7 Link Status
check_command check_snmp!-C public -o ifOperStatus.1 -r 7 -m RFC1213-MIB
}

define service {

use generic-service
host_name 3-Com-Switch
service_description Port 8 Link Status
check_command check_snmp!-C public -o ifOperStatus.1 -r 8 -m RFC1213-MIB
}


Can anybody help me, to find the failure?
Why is the state critical ?

Greets :)
User avatar
rhassing
Posts: 412
Joined: Sat Oct 05, 2013 10:29 pm
Location: Netherlands

Re: SNMP CRITICAL - *up(1)*

Post by rhassing »

You have an error in the service config:

For interface 1 use:

Code: Select all

check_command check_snmp!-C public -o ifOperStatus.1 -r 1 -m RFC1213-MIB
For interface 2 use:

Code: Select all

check_command check_snmp!-C public -o ifOperStatus.[b]2[/b] -r [b]1[/b] -m RFC1213-MIB
The -r should always have 1 (or up)

The number behind ifOperStatus is the interface number, the -r option is what is expected from the output (in regex)
Rob Hassing
Image
silentnoise
Posts: 20
Joined: Tue Jun 02, 2020 3:51 pm

Re: SNMP CRITICAL - *up(1)*

Post by silentnoise »

Hi,
thanks for reply.
Are you sure ?




I changed into:

Code: Select all

define service {

        use                                 generic-service
        host_name                      3-Com-Switch
        service_description          Port 2 Link Status
        check_command              check_snmp!-C public ifOperStatus.2 -r 1 -m RFC1213-MIB
}
It says:

Code: Select all

3-Com-Switch
	
	
Port 2 Link Status
	
	UNKNOWN 	05-13-2021 19:13:21 	0d 0h 5m 47s 	3/3 	External command error: Error in packet 

Service Unknown[05-13-2021 19:13:21] SERVICE ALERT: 3-Com-Switch;Port 2 Link Status;UNKNOWN;HARD;3;External command error: Error in packet
User avatar
rhassing
Posts: 412
Joined: Sat Oct 05, 2013 10:29 pm
Location: Netherlands

Re: SNMP CRITICAL - *up(1)*

Post by rhassing »

Your command is nog correct anymote. I think it's missing the -o

Code: Select all

define service {

        use                                 generic-service
        host_name                      3-Com-Switch
        service_description          Port 2 Link Status
        check_command              check_snmp!-C public ifOperStatus.2 -r 1 -m RFC1213-MIB
}
Should be

Code: Select all

define service {

        use                                 generic-service
        host_name                      3-Com-Switch
        service_description          Port 2 Link Status
        check_command              check_snmp!-C public -o ifOperStatus.2 -r 1 -m RFC1213-MIB
}
Rob Hassing
Image
silentnoise
Posts: 20
Joined: Tue Jun 02, 2020 3:51 pm

Re: SNMP CRITICAL - *up(1)*

Post by silentnoise »

Hi,

i`m sorry i forgot the "-o".
I write it manually into the post.

define service {

use generic-service
host_name 3-Com-Switch
service_description Port 2 Link Status
check_command check_snmp!-C public -o ifOperStatus.2 -r 1 -m RFC1213-MIB
}

This is the ertry in the file...
User avatar
rhassing
Posts: 412
Joined: Sat Oct 05, 2013 10:29 pm
Location: Netherlands

Re: SNMP CRITICAL - *up(1)*

Post by rhassing »

What do you see if you execute the command in the command line?

Can you post that? Command and output.
Rob Hassing
Image
silentnoise
Posts: 20
Joined: Tue Jun 02, 2020 3:51 pm

Re: SNMP CRITICAL - *up(1)*

Post by silentnoise »

But it doesn't work
silentnoise
Posts: 20
Joined: Tue Jun 02, 2020 3:51 pm

Re: SNMP CRITICAL - *up(1)*

Post by silentnoise »

root@raspberrypi:/usr/local/nagios/libexec# ./check_snmp -H 192.168.178.3 public -o ifOperStatus.2 -r 1 -m RFC1213-MIB
External command error: Error in packet
Reason: (noSuchName) There is no such variable name in this MIB.
Failed object: RFC1213-MIB::ifOperStatus.2
silentnoise
Posts: 20
Joined: Tue Jun 02, 2020 3:51 pm

Re: SNMP CRITICAL - *up(1)*

Post by silentnoise »

I`ve done a SNMPwalk.

Is it possible that the other ports cannot be read out?
Attachments
snmpwalk.txt
SNMPwalk
(34.41 KiB) Downloaded 2499 times
User avatar
rhassing
Posts: 412
Joined: Sat Oct 05, 2013 10:29 pm
Location: Netherlands

Re: SNMP CRITICAL - *up(1)*

Post by rhassing »

What happens if you don't specify the mib file?
So don't use the -m option.
Rob Hassing
Image
Locked