SteScho / manubulon-snmp

Set of Icinga/Nagios plugins to check hosts and hardware with the SNMP protocol.
GNU General Public License v2.0
73 stars 71 forks source link

Questen Parameter usage for icinga2 #78

Open Marco-Total opened 3 years ago

Marco-Total commented 3 years ago

Hi,

i wan't use your snmp check script to monitor my network interfaces in icnga2. In my case i create a check command with the following paramaters:

-t 10 snmp timeout in seconds -H host -L <authp,privp> -l snmpv3 username -x password Auth -X password Priv -n --64bits use 64Bit snmp-counter (for 1GBit/s and higher) --label -N use IfName instead ifDeDescr -Y output performance data in bits/s -B output performance data in bits instead bytes -k check Bandwith -q check Bandwith include error and discard -f Performance data output for graphite/nagvis/grafana -e Performance data output include error and discard -S Include speed in performance (output: $interface$_speed_bps)
-d 60 average of Delta in seconds -M warning and critiacl in Mbps -w 200,200,1,1,1,1 -c 280,280,2,2,2,2

Now I have 3 question for usable and hope, that somebody can help me.

  1. With the Parameter -S i get following error: Use of uninitialized value $speed_real in concatenation (.) or string at /usr/lib64/nagios/plugins/check_snmp_int.pl line 1100. The output looks like this: eth0_speed_bps= Is this a script error?

  2. In every 60s output I see 531 discard-errors on interface: 'eth0_in_discard'=531c Is it possible the only the delta discard and error packets?

  3. The warning and critical level for discards and errors don't work for me:

    grafik

    Is it possible, that the sensor switch to warning/critical, when the delta contains x discard/error-packets?

Thx a lot for every help!

SteScho commented 3 years ago

Hi.

Just a short question at the beginning: Do you really use the check_snmp_int.pl from this repo? Perl claims line 1100 but that script has only 1085 lines.

To your questions:

  1. Normally that happens if your switch don't send the interface speed via snmp.
  2. The uom is c. Your monitoring solutions should be able to handle that.
  3. Hm, not yet. But you are welcome to send a PR with suitable code.

A general tip: Can you start the command on the cli and add -v as an argument? This gives you more details on what this command is doing in the background.

Marco-Total commented 3 years ago

Hi,

first thx for your support!

  1. Sorry, I recopy the source code from git to the checkscript, with the Parameter -S and -v I can see, that the Interface-Speed read corectly:

    '/usr/lib64/nagios/plugins/check_snmp_int.pl' '-t' '10' '-H' '172.xx.xx.xx' '-x' 'password' '-L' 'sha,aes' '-X' 'password' '-n' 'eth0' '-l' 'username' '-N' '--label' '-q' '-k' '-e' '-f' '-d' '60' '-c' '280,280,2,2,2,2' '-Y' '-M' '-B' '-w' '200,200,1,1,1,1' '--64bits'  -S -v
    Alarm in 10 seconds
    SNMPv3 AuthPriv login : username, sha, aes
    Filter : eth0
    OID : 1.3.6.1.2.1.31.1.1.1.1.143, Desc : br1
    OID : 1.3.6.1.2.1.31.1.1.1.1.2, Desc : eth0
    **Name : eth0, Index : 2**
    OID : 1.3.6.1.2.1.31.1.1.1.1.3, Desc : eth1
    ...
    File read returns : 0 with 200 rows
    **Interface speed : 100000000**
    Write file returned : 0
    Interface 0, check 0 : 0.232522642201835
    Interface 0, check 1 : 0.242002788990826
    Interface 0, check 2 : 0
    Interface 0, check 3 : 0
    Interface 0, check 4 : 0
    Interface 0, check 5 : 0
    Use of uninitialized value $speed_real in concatenation (.) or string at /usr/lib64/nagios/plugins/check_snmp_int.pl line 1042.
    eth0:UP (in=0.2Mbps/out=0.2Mbps/errors-in=0.0/errors-out=0.0/discard-in=0.0/discard-out=0.0):1 UP: OK | 'eth0_in_bps'=232523;200000000;280000000;0;100000000 'eth0_out_bps'=242003;200000000;280000000;0;100000000 'eth0_in_error'=0c 'eth0_in_discard'=531c 'eth0_out_error'=0c 'eth0_out_discard'=0c 'eth0_speed_bps'=
  2. We use Icinga2, if I read the icinga2 docs, i find a descripten, that Icinga2 support the uom c. https://icinga.com/docs/icinga-2/latest/doc/05-service-monitoring/#unit-of-measurement-uom c - A continuous counter (e.g. interface traffic counters).

  3. sorry, I can program something in principle, but deeper knowledge and experience I do not have, I see myself more as a user ;-)

SteScho commented 3 years ago

So it works now for you? If so I will close that issue. Or do you have any further questions?

Marco-Total commented 3 years ago

Hi,

  1. No, with the parameter "-v" i can see, that the script can read the interface speed, but the output still looks like this: eth0_speed_bps=
  2. Why couldn't Icinga2 can't handle the output correctly?
  3. Why I can see the warning and critical level in the output vor in/out speed, but not for error/discard level?

I love this script, but special with the second and third point i can't use the script :-(

Cheers, Marco

SteScho commented 3 years ago

Hi Marco.

  1. Can you try to fix line 1041 in the check? The line looks like my $speed_real = "" unless (defined($speed_real)); and I think you should just remove the my at the beginning.
  2. Icinga2 does handle the output correctly. Can you give me some more information about what you think that the problem with Icinga2 is in detail?
  3. The UOM is c. Warning and critical makes usually no sense here. But what do you want to achieve? Maybe it needs some explanation or that there is an alternative solution.

Regards, Steffen

Marco-Total commented 3 years ago

Hi Steffen,

thank you!

  1. Remove thy "my" in line 1041 solve the problem with the output of the line speed!

  2. The Plugin-Output looks good (120 discard packets since last messure), but the Performancedata don't display the delta value since last messure, it shows the all time discard packets: 1

  3. The first problem is, that the warning and critical value don't display in Icinga Perfomancedata-output: 2

I want configure, that the sensor go in warning state, when for example the discard packets over 120 discard packets since last messure, see question 2). Now I configured, that the sensor go in warning state when all time discard packetes reach 35.000.000. I hope you understand my bad english! ;-)

'/usr/lib64/nagios/plugins/check_snmp_int.pl' '-t' '10' '-H' '172.00.00.10' '-x' 'password' '-L' 'sha,aes' '-n' 'eth0' '-X' 'password' '-l' 'username' '-N' '--label' '-q' '-k' '-e' '-S' '-d' '60' '-f' '-c' '280,280,50,50,40000000,50' '-Y' '-M' '-B' '-w' '250,250,25,25,35000000,25' '--64bits'

SteScho commented 3 years ago

Hi Marco.

  1. I have updated the source on github and removed that my too
  2. The output of the performance data of Icinga2 is correct. Just remember that Icinga2 only shows that data and don't interpreted in any way. That is just a simple -show me what you get- overview. Not more. If you want a deeper look use any of those visualizing tools.
  3. I know what you mean. That would be a bigger change if it is possible. And it only works if you store the latest check result on disk. Unfortunately, I don't have the time for such a change at the moment - I'm more of the moderator here. If you knew someone who could build it, just send me the associated PR.