Page 1 of 2

Problems to see the bandwidth correctly with mrtg

Posted: Thu Nov 09, 2017 9:01 am
by jorgeinteractivo
hello people, I have a problem that I can not solve because I ask for help from this kind community.
I want to monitor a port of a cisco switch, I'm using mrtg, I generate the .log file and I get to see the graph and the consumption correctly (Out 40.7 Mb / s (4.1%), In 25.3 Mb / s (2.5%)), The port in question is fiber optic with a speed of 1GB, therefore that is the limit.
But when the file.cfg that corresponds to the host, I use the command:
check_command check_local_mrtgtraf! /var/www/mrtg/172.16.100.190_gigabitethernet1_0_25.log! AVG! 500000000,600000000! 900000000,1000000000! 10
On the Nagios graph and also using the pnp4nagios plugin, it shows me the wrong data, (Traffic OK - Avg. In = 2.0 MB / s, Avg. Out = 3.8 MB / s)
I was researching a lot, and maybe I saw some plugin use bits and other bytes. But I do not know why in one place the graph and consumption are good and in another place it is different.

I do the test with the dude, and it's equivalent to the graph that I attached to nagios2-mrtg, so it's apparently correct that configuration.

I hope you can help me. Greetings from Argentina

Re: Problems to see the bandwidth correctly with mrtg

Posted: Fri Nov 10, 2017 3:46 pm
by kyang
Would the use a different plugin be an option for you?

Also what version of the check_mrtgtraf plugin do you have?

Code: Select all

./check_mrtgtraf -V
If you are using the check_mrtgtraf plugin from the Nagios plugins.

Have you tested out other plugins in the Nagios exchange for checking bandwidth or so?

https://exchange.nagios.org/

Re: Problems to see the bandwidth correctly with mrtg

Posted: Fri Nov 17, 2017 7:26 am
by jorgeinteractivo
Currently, I am using
check_mrtgtraf v2.2.1 (nagios-plugins 2.2.1)

This is the config of my host:

define service {
use generic-service,srv-pnp
host_name sw-01
service_description Port 25 Bandwidth Usage
check_command check_local_mrtgtraf!/var/www/mrtg/172.16.100.190_gigabitethernet1_0_25.log!AVG!5000000,6000000!9000000,10000000!10
}

I need to be able to visualize the bandwidth of a network interface, the equipment is a cisco catalyst 2960 switch. Or maybe configure to show the option in real megaytes, I do not know why it shows so little in The Dude shows much more, or in the same mrtg it looks good. If there is another tool that I would like to recommend, but until now everything that probe did not work
.
the dude.jpg

Re: Problems to see the bandwidth correctly with mrtg

Posted: Fri Nov 17, 2017 2:44 pm
by kyang
I'm not entirely sure, you could try posting in the nagiosgraph discussion to see if anyone has encountered the same issue?
https://sourceforge.net/p/nagiosgraph/discussion/394748

Also, here's something I saw

Code: Select all

- The calculated i/o rates are a little off from what MRTG actually
   reports.  I'm not sure why this is right now, but will look into it
   for future enhancements of this plugin.
http://nagios-plugins.org/doc/man/check_mrtgtraf.html

It seems like the plugin hasn't been updated for quite some time now according to GitHub.

Re: Problems to see the bandwidth correctly with mrtg

Posted: Fri Nov 24, 2017 12:13 pm
by jorgeinteractivo
I was researching more, and I could do something, in the host configuration file /etc/mrtg/switch1.cfg in the options section I was changing values:

Originally had:
# to get bits instead of bytes and graphs growing to the right
#Options [_]: growright, bits

And I change it for this:
Options [_]: growright, nopercent, gauge
 
As a result of the graphics that it shows me through the web interface, it gives me the same result that I see on the nagios website. I think it's a format issue in Nagios but I can not imagine where it can be, in the case of mrtg I know where it is, and leaving the bits option shows me the real value in megabytes as attach to the screenshots, any suggestions?

Re: Problems to see the bandwidth correctly with mrtg

Posted: Fri Nov 24, 2017 12:47 pm
by jorgeinteractivo
I think it's the command, although I see that several tools show me this, it has to do with the output format of the command, that's why it shows that value, I do not know how to tell it to show the result as bits.

# ./check_mrtgtraf -F /var/www/mrtg/172.16.100.190_gigabitethernet1_0_25.log -a MAX

Result:
Traffic CRITICAL - Max. In = 1.5 MB/s, Max. Out = 3.7 MB/s|in=1.523050MB;;;0.000000 out=3.686069MB;;;0.000000

Re: Problems to see the bandwidth correctly with mrtg

Posted: Fri Nov 24, 2017 2:00 pm
by jorgeinteractivo
I'm using a script check_snmp_int_v3, I made it work but I do not know how to create a command and service, do they give me a hand?

./check_snmp_int.pl -v2c -H 172.16.100.190 -C public -n GigabitEthernet1/0/25 -k -BM -w 200000,400000 -c 600000,900000
Alarm at 15 + 5
SNMP v2c login
Filter : GigabitEthernet1/0/25
OID : 1.3.6.1.2.1.2.2.1.2.10123, Desc : GigabitEthernet1/0/23
OID : 1.3.6.1.2.1.2.2.1.2.10108, Desc : GigabitEthernet1/0/8
OID : 1.3.6.1.2.1.2.2.1.2.10126, Desc : GigabitEthernet1/0/26
OID : 1.3.6.1.2.1.2.2.1.2.5179, Desc : StackPort1
OID : 1.3.6.1.2.1.2.2.1.2.10117, Desc : GigabitEthernet1/0/17
OID : 1.3.6.1.2.1.2.2.1.2.10127, Desc : GigabitEthernet1/0/27
OID : 1.3.6.1.2.1.2.2.1.2.10104, Desc : GigabitEthernet1/0/4
OID : 1.3.6.1.2.1.2.2.1.2.10107, Desc : GigabitEthernet1/0/7
OID : 1.3.6.1.2.1.2.2.1.2.10119, Desc : GigabitEthernet1/0/19
OID : 1.3.6.1.2.1.2.2.1.2.10113, Desc : GigabitEthernet1/0/13
OID : 1.3.6.1.2.1.2.2.1.2.10106, Desc : GigabitEthernet1/0/6
OID : 1.3.6.1.2.1.2.2.1.2.10120, Desc : GigabitEthernet1/0/20
OID : 1.3.6.1.2.1.2.2.1.2.10111, Desc : GigabitEthernet1/0/11
OID : 1.3.6.1.2.1.2.2.1.2.10115, Desc : GigabitEthernet1/0/15
OID : 1.3.6.1.2.1.2.2.1.2.10121, Desc : GigabitEthernet1/0/21
OID : 1.3.6.1.2.1.2.2.1.2.1, Desc : Vlan1
OID : 1.3.6.1.2.1.2.2.1.2.10103, Desc : GigabitEthernet1/0/3
OID : 1.3.6.1.2.1.2.2.1.2.14001, Desc : Null0
OID : 1.3.6.1.2.1.2.2.1.2.5181, Desc : StackSub-St1-2
OID : 1.3.6.1.2.1.2.2.1.2.10101, Desc : GigabitEthernet1/0/1
OID : 1.3.6.1.2.1.2.2.1.2.10128, Desc : GigabitEthernet1/0/28
OID : 1.3.6.1.2.1.2.2.1.2.10118, Desc : GigabitEthernet1/0/18
OID : 1.3.6.1.2.1.2.2.1.2.10109, Desc : GigabitEthernet1/0/9
OID : 1.3.6.1.2.1.2.2.1.2.10116, Desc : GigabitEthernet1/0/16
OID : 1.3.6.1.2.1.2.2.1.2.10124, Desc : GigabitEthernet1/0/24
OID : 1.3.6.1.2.1.2.2.1.2.10112, Desc : GigabitEthernet1/0/12
OID : 1.3.6.1.2.1.2.2.1.2.14002, Desc : FastEthernet0
OID : 1.3.6.1.2.1.2.2.1.2.10102, Desc : GigabitEthernet1/0/2
OID : 1.3.6.1.2.1.2.2.1.2.10122, Desc : GigabitEthernet1/0/22
OID : 1.3.6.1.2.1.2.2.1.2.10110, Desc : GigabitEthernet1/0/10
OID : 1.3.6.1.2.1.2.2.1.2.5180, Desc : StackSub-St1-1
OID : 1.3.6.1.2.1.2.2.1.2.10105, Desc : GigabitEthernet1/0/5
OID : 1.3.6.1.2.1.2.2.1.2.10125, Desc : GigabitEthernet1/0/25
Name : GigabitEthernet1/0/25, Index : 10125
OID : 1.3.6.1.2.1.2.2.1.2.10114, Desc : GigabitEthernet1/0/14
File read returns : 0 with 72 rows
Interface speed : 1000000000
Write file returned : 1
Interface 0, check 0 : 11.5882787433628
Interface 0, check 1 : 31.8223325486726
GigabitEthernet1/0/25:UP !!Unable to write file /tmp/tmp_Nagios_int.172.16.100.190.GigabitEthernet 1_0_25 !! (11.6Mbps/31.8Mbps):(1 UP): UNKNOWN
#

Re: Problems to see the bandwidth correctly with mrtg

Posted: Mon Nov 27, 2017 5:26 pm
by dwhitfield
Who created this one?

Code: Select all

define service {
use generic-service,srv-pnp
host_name sw-01
service_description Port 25 Bandwidth Usage
check_command check_local_mrtgtraf!/var/www/mrtg/172.16.100.190_gigabitethernet1_0_25.log!AVG!5000000,6000000!9000000,10000000!10
}
Basically, you do the same thing. You can just look at your current commands to get an idea of the syntax there. Is 172.16.100.190 called sw-01?

You don't say which version of Core you are using, but here's the documentation for objects for 4: https://assets.nagios.com/downloads/nag ... tions.html

Usually, commands would go in a commands.cfg file, but they don't have to.

What's the output ls -la /usr/local/nagios/etc? That will tell us a bit about your current setup and should help us tell you the best place to put the command.

Re: Problems to see the bandwidth correctly with mrtg

Posted: Tue Nov 28, 2017 9:27 am
by jorgeinteractivo
This is the page of nagios, my problem is that the visualization but in a different format, I am using version 4.3.4 of Nagios Core. The ip correponde to switch sw-01, I leave the command and the service, the commands I have in the file commands.cfg in the directory objets where most are working well.

drwxrwxr-x 3 nagios nagios 198 Nov 3 13:31 objects

# 'check_local_mrtgtraf' definición de comando
define el comando {
        command_name check_local_mrtgtraf
        command_line $ USER1 $ / check_mrtgtraf -F $ ARG1 $ -a $ ARG2 $ -w $ ARG3 $ -c $
        }


definir servicio {
use generic-service, srv-pnp
host_name sw-01
service_description Port 25 Bandwidth Usage
check_command check_local_mrtgtraf!/var/www/mrtg/172.16.100.190_gigabitethernet1_0_25.log!AVG! 5000000,6000000! 9000000,10000000! 10
}

Re: Problems to see the bandwidth correctly with mrtg

Posted: Wed Nov 29, 2017 4:36 pm
by kyang
I'm using a script check_snmp_int_v3, I made it work but I do not know how to create a command and service, do they give me a hand?

./check_snmp_int.pl -v2c -H 172.16.100.190 -C public -n GigabitEthernet1/0/25 -k -BM -w 200000,400000 -c 600000,900000
Is this the script you want to create a service check for?

Did you define the command in your commands.cfg?

From how you ran the script you have something like this.
-v2c -H $HOSTADDRESS$ -C $ARG1$ -n $ARG2$ -k -BM -w $ARG3$ -c $ARG4$

Code: Select all

# 'check_snmp_int.pl' command definition
define command{
        command_name    check_snmp_int.pl
        command_line    $USER1$/check_snmp_int.pl -v2c -H $HOSTADDRESS$ -C $ARG1$ -n $ARG2$ -k -BM -w $ARG3$ -c $ARG4$
        }
It should look something like this? I don't have the script so I can't fully test it.

Either way, test it out and let us know.