Nagios - find interface name

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.
Locked
hausrocker
Posts: 16
Joined: Wed Jan 13, 2021 8:48 am

Nagios - find interface name

Post by hausrocker »

Hi

I have basically 2 questions:

1. How can I manually issue a certain command via console to manually start a check? Right now I am always downloading a .cfg file, change settings in switch.cfg for example, upload the file again, run pre-flight check, reload nagios service, issue new check, wait some minutes, see the result.
Is there a way to start this command via console:

Code: Select all

define service{
	use			generic-service	; Inherit values from a template
	host_name		N8-TWB
	service_description	Uplink	
	check_command		check_snmp_int!ethernetg11!400000!600000!0!800000
	}
2. This particular switch does not let me use the default cisco cli to find out about the interface name. I always have an error "ERROR : Unknown interface ethernet " in the check on the nagios webinterface.
I have SNMP running and already used a SNMP tester with "scan interfaces".

There is a list of interfaces the SNMP Tester gives me:

Code: Select all

Found standard interfaces:
1:Ethernet Interface: (001) Ethernet Interface Traffic,Not Connected,1 GBit/s,Ethernet,Ethernet Interface
2:Ethernet Interface: (002) Ethernet Interface Traffic,Not Connected,1 GBit/s,Ethernet,Ethernet Interface
3:Ethernet Interface: (003) Ethernet Interface Traffic,Not Connected,1 GBit/s,Ethernet,Ethernet Interface
4:Ethernet Interface: (004) Ethernet Interface Traffic,Not Connected,1 GBit/s,Ethernet,Ethernet Interface
5:Ethernet Interface: (005) Ethernet Interface Traffic,Not Connected,1 GBit/s,Ethernet,Ethernet Interface
6:Ethernet Interface: (006) Ethernet Interface Traffic,Not Connected,1 GBit/s,Ethernet,Ethernet Interface
7:Ethernet Interface: (007) Ethernet Interface Traffic,Not Connected,1 GBit/s,Ethernet,Ethernet Interface
8:Ethernet Interface: (008) Ethernet Interface Traffic,Not Connected,1 GBit/s,Ethernet,Ethernet Interface
9:Ethernet Interface: (009) Ethernet Interface Traffic,Not Connected,1 GBit/s,Ethernet,Ethernet Interface
10:Ethernet Interface: (010) Ethernet Interface Traffic,Not Connected,1 GBit/s,Ethernet,Ethernet Interface
11:Uplink SX350: (011) Uplink SX350 Traffic,Connected,1 GBit/s,Ethernet,Uplink SX350
12:Uplink Unifi: (012) Uplink Unifi Traffic,Connected,1 GBit/s,Ethernet,Uplink Unifi
13:Ethernet Interface: (013) Ethernet Interface Traffic,Not Connected,1 GBit/s,Ethernet,Ethernet Interface
14:Ethernet Interface: (014) Ethernet Interface Traffic,Not Connected,1 GBit/s,Ethernet,Ethernet Interface
15:Ethernet Interface: (015) Ethernet Interface Traffic,Not Connected,1 GBit/s,Ethernet,Ethernet Interface
16:Ethernet Interface: (016) Ethernet Interface Traffic,Not Connected,1 GBit/s,Ethernet,Ethernet Interface
17:Ethernet Interface: (017) Ethernet Interface Traffic,Not Connected,1 GBit/s,Ethernet,Ethernet Interface
18:Ethernet Interface: (018) Ethernet Interface Traffic,Connected,1 GBit/s,Ethernet,Ethernet Interface
19:Ethernet Interface: (019) Ethernet Interface Traffic,Not Connected,1 GBit/s,Ethernet,Ethernet Interface
20:Ethernet Interface: (020) Ethernet Interface Traffic,Not Connected,1 GBit/s,Ethernet,Ethernet Interface
21:Ethernet Interface: (021) Ethernet Interface Traffic,Not Connected,1 GBit/s,Ethernet,Ethernet Interface
22:Ethernet Interface: (022) Ethernet Interface Traffic,Not Connected,1 GBit/s,Ethernet,Ethernet Interface
23:Ethernet Interface: (023) Ethernet Interface Traffic,Not Connected,1 GBit/s,Ethernet,Ethernet Interface
24:Ethernet Interface: (024) Ethernet Interface Traffic,Not Connected,1 GBit/s,Ethernet,Ethernet Interface
1000:Ethernet Interface: (1000) Ethernet Interface Traffic,Not Present,,Ethernet,Ethernet Interface
1001:Ethernet Interface: (1001) Ethernet Interface Traffic,Not Present,,Ethernet,Ethernet Interface
1002:Ethernet Interface: (1002) Ethernet Interface Traffic,Not Present,,Ethernet,Ethernet Interface
1003:Ethernet Interface: (1003) Ethernet Interface Traffic,Not Present,,Ethernet,Ethernet Interface
1004:Ethernet Interface: (1004) Ethernet Interface Traffic,Not Present,,Ethernet,Ethernet Interface
1005:Ethernet Interface: (1005) Ethernet Interface Traffic,Not Present,,Ethernet,Ethernet Interface
1006:Ethernet Interface: (1006) Ethernet Interface Traffic,Not Present,,Ethernet,Ethernet Interface
1007:Ethernet Interface: (1007) Ethernet Interface Traffic,Not Present,,Ethernet,Ethernet Interface
100000:vlan: (100000) vlan Traffic,Not Connected,,proprietary virtual/internal interface,vlan
100049:vlan: (100049) vlan Traffic,Connected,,proprietary virtual/internal interface,vlan
100081:vlan: (100081) vlan Traffic,Connected,,proprietary virtual/internal interface,vlan
100098:vlan: (100098) vlan Traffic,Connected,,proprietary virtual/internal interface,vlan
100100:vlan: (100100) vlan Traffic,Connected,,proprietary virtual/internal interface,vlan
But I can not test for Interface number 11: Tried ge11, GigabitEthernet11, Ethernet11, 11, Uplink SX-350- how do I find the right name?
Also anything with a space in the name, it only checks for the first part.
So if I use "check_snmp_int!Uplink SX350!400000!600000!0!800000" it gives me "ERROR : Unknown interface Uplink" - it ignores the 350. Or do I need to remove the space and rename the interface to Uplink-SX350 and then check for Uplink-SX350?

Thank you for help.
hausrocker
Posts: 16
Joined: Wed Jan 13, 2021 8:48 am

Re: Nagios - find interface name

Post by hausrocker »

no support at all on this topic? or too difficult?
gormank
Posts: 1114
Joined: Tue Dec 02, 2014 12:00 pm

Re: Nagios - find interface name

Post by gormank »

For question #1 my system has the following for the check_snmp_int command.
For #2 have you tried double or single quoting the I/F name?

Command Name Command Line
check_snmp_int $USER1$/check_snmp_int.pl -H $HOSTADDRESS$ -C $ARG1$ -2 -n $ARG2$ -f -k -w $ARG3$ -c $ARG4$ $ARG5$

So

check_command check_snmp_int!ethernetg11!400000!600000!0!800000

Translates to something like this

/usr/local/nagios/libexec/check_snmp_int.pl -H put_your_switch_address_here -C ethernetg11 -2 -n 400000 -f -k -w 600000 -c 0 800000

You may want to run the script with -h to get a list of possible arguments since that looks a bit odd.
hausrocker
Posts: 16
Joined: Wed Jan 13, 2021 8:48 am

Re: Nagios - find interface name

Post by hausrocker »

Code: Select all

[root@deghmo02 libexec]# ./check_snmp_int.pl -H put_your_switch_address_here -C ethernetg11 -2 -n 400000 -f -k -w 600000 -c 0 800000
2 warning levels for bandwidth checks

Usage: ./check_snmp_int.pl [-v] -H <host> -C <snmp_community> [-2] | (-l login -x passwd [-X pass -L <authp>,<privp>)  [-p <port>] -n <name in desc_oid> [-i] [-a] [-r] [-f[eSyY]] [-k[qBMGu] -g -w<warn levels> -c<crit levels> -d<delta>] [-o <octet_length>] [-t <timeout>] [-s] --label [-V]
And regarding quoting:
You mean I should use

Code: Select all

check_snmp_int!"Uplink SX350"!400000!600000!0!800000
instead of

Code: Select all

check_snmp_int!Uplink SX350!400000!600000!0!800000
?

How can I find rhe right interface name with SNMP Walk when I use "scan interfaces"? That gives me a ton of possible names.
Locked