PDA

View Full Version : Monitoring with NET-SNMP


chocho63
11-10-2005, 18:00
(for all platforms, Linux, Solaris, Aix, HP-UX)

You can monitor traffic with these OIDs with Zabbix :

IP-MIB::ipAdEntIfIndex.[Addr IP] -> Addr IP is the host IP, for example IP-MIB::ipAdEntIfIndex.10.189.52.123 : returns the number of the interface used below (N° int).

IF-MIB::ifDescr.[N° int] -> Name of the interface
IF-MIB::ifInDiscards.[N° int] -> Number of discards packets in
IF-MIB::ifOutDiscards.[N° int] -> Number of discards packets out
IF-MIB::ifInErrors.[N° int] -> Number of errors packets in
IF-MIB::ifOutErrors.[N° int] -> Number of errors packets out
IF-MIB::ifInOctets.[N° int] -> Number of octets in
IF-MIB::ifOutOctets.[N° int] -> Number of octets out
IF-MIB::ifInNUcastPkts.[N° int] -> Number of non-unicast packets in (except Linux)
IF-MIB::ifOutNUcastPkts.[N° int] -> Number of non-unicast packets out (except Linux)
IF-MIB::ifInUcastPkts.[N° int] -> Number of unicast packets in
IF-MIB::ifOutUcastPkts.[N° int] -> Number of unicast packets out
for example IF-MIB::ifInOctets.2


You can monitor Memory and Swap with these OID, using a custom multiplier of 1024 (size in Kbytes) :

UCD-SNMP-MIB::memAvailReal.0 -> Memory available
UCD-SNMP-MIB::memTotalReal.0 -> Total memory
UCD-SNMP-MIB::memAvailSwap.0 -> Swap available
UCD-SNMP-MIB::memTotalSwap.0 -> Total swap


You can monitor Load Average with these OID :

UCD-SNMP-MIB::laLoadInt.1 -> Load average / 1 min
UCD-SNMP-MIB::laLoadInt.2 -> Load average / 5 min
UCD-SNMP-MIB::laLoadInt.3 -> Load average / 15 min

Use a custom multiplier of 0.01 for these values.


You can monitor CPU utilisation (%) with these OID :

Instant monitor, not an average :

UCD-SNMP-MIB::ssCpuRawUser.0 -> Number of timeticks used by users's process (AIX, Solaris, Linux, HP-UX)
UCD-SNMP-MIB::ssCpuRawSystem.0 -> Number of timeticks used by system's process (AIX, Solaris, Linux, HP-UX)
UCD-SNMP-MIB::ssCpuRawIdle.0 -> Number of timeticks unused (AIX, Solaris, Linux, HP-UX)
UCD-SNMP-MIB::ssCpuRawWait.0-> Number of timeticks used by process waiting (AIX, Solaris, HP-UX)
UCD-SNMP-MIB::ssCpuRawNice.0-> Number of timeticks used by nice process (Linux, HP-UX)
UCD-SNMP-MIB::ssCpuRawKernel.0 -> Number of timeticks used by kernel process (AIX, Solaris, Linux, HP-UX)

Configure the item with an OID, chose a custom multiplier of :
- 1 * 100 / (delay between checks * number of timeticks per second * number of CPU) for Linux
- 1 * 100 * number of CPU / (delay between checks * number of timeticks per second) for HP-UX
- 1 * 100 / (delay between checks * number of timeticks per second) for AIX and Solaris
store 'Delta Simple Change'.
To get the number of timeticks per second, use 'getconf CLK_TCK'. It's always 100 on hosts I've tested.
For example, with CLK_TCK=100 (Linux i386), check every 10 seconds, 2 CPU, the custom multiplier is 0.05.
For Linux, it's the logical number of CPU displayed by command 'top', not the physical number.


You can monitor number of processes and users with these OID :

HOST-RESOURCES-MIB::hrSystemNumUsers.0
HOST-RESOURCES-MIB::hrSystemProcesses.0


For UCD-SNMP-MIB, net-snmp must be compiled with option '--with-mib-modules=’ucd-snmp/diskio'
For HOST-RESOURCES-MIB, net-snmp must be compiled with option '--with-mib-modules=’host'

James Wells
11-10-2005, 18:19
Greetings,

Excellent info Chocho. Very helpful. :)

Godzilla
11-04-2006, 11:28
UCD-SNMP-MIB::ssCpuRawIdle.0 -> Number of timeticks unused (AIX, Solaris, Linux, HP-UX)
1 * 100 / (delay between checks * number of timeticks per second * number of CPU) for Linux

It's hard to get a good reading for "ssCpuRawIdle" since a busy Zabbix server may not take a reading exactly at, for example, every 10 seconds. The % could go way out of whack, like to 300%.

I had to write a small command line script and place it in the snmpd.conf to get the CPU %.

diopter
27-06-2006, 09:14
May i know how to get "delay between checks"?
if anyone knows pls reply ..
i really nid to get this thing works.

grabber
28-06-2006, 13:30
May i know how to get "delay between checks"?
if anyone knows pls reply ..
i really nid to get this thing works.


is that not set by you ion the Item configuration?

diopter
03-07-2006, 13:11
is that not set by you ion the Item configuration?

Below is how i configure to monitor cpu utilization (%) . But i failed to get the correct value, so please correct me if u see any mistake.
thx alot!

To monitor cpu idle
Snmp OID: .1.3.6.1.4.1.2021.11.53.0
Type: Float
Units: <none>
Multiplier: 0.025 [1 * 100 / (10 * 100 * 4) = 0.025]
Store Value: Delta Simple Change

The value i get = 173.97

my server have 4 processors and the actually idle value by tat time should be 98% idle.

i wonder which part i did wrong..
how do i make it to collect the same value as it shown in TOP
HELP?

grabber
03-07-2006, 13:30
which OS are you using?
and can you give me an example of the data you have recieved, so we can try to work this out?

My Zabbix server is getting rebuilt but as it is 5500 miles away I have to wait on the locals to get to it...

Thanks

diopter
03-07-2006, 13:39
which OS are you using?
and can you give me an example of the data you have recieved, so we can try to work this out?

My Zabbix server is getting rebuilt but as it is 5500 miles away I have to wait on the locals to get to it...

Thanks

im using Advance Server 4 U3 and the date i received is 173.97..

and the counter value i received

snmpwalk -c mycommunity -v 2c x.x.x.x .1.3.6.1.4.1.2021.11.ssCpuRawIdle.0 -On

.1.3.6.1.4.1.2021.11.53.0 = Counter32: 1781085473

thx for fast reply

grabber
04-07-2006, 19:09
"Update interval (in sec)" is configured as part of the Item...what have you got for that? I think that is what you use in the multiplier.

Ian

diopter
04-07-2006, 19:40
"Update interval (in sec)" is configured as part of the Item...what have you got for that? I think that is what you use in the multiplier.

Ian

Update Interval i set it to 10 second ..

and the data i get sometimes is 126.45, 98 , 86 ..
i dun get it y the data exceed 100, suppose it should be counted as percentage.

really nid help here..

grabber, alexi or anyone.
pls help !

grabber
04-07-2006, 21:19
remember what you are checking loks to be "Store Value: Delta Simple Change" is this really what you want to check?

you caxn pm me and I will give you my msn

ian

also: are you sure you are getting the correct value out?

diopter
05-07-2006, 08:07
remember what you are checking loks to be "Store Value: Delta Simple Change" is this really what you want to check?

you caxn pm me and I will give you my msn

ian

also: are you sure you are getting the correct value out?

actually delta simple change is wat? i have no ideal..
but if i pust:
"Store Value: As is"
it will show the counter value.

so i think Store Value should be "delta simple change"

wat i wan is to monitor cpu utilisation (in percentage) for:
ssCpuRawIdle, ssCpuRawUser and ssCpuRawSytem

grabber
05-07-2006, 13:04
OK I think I got my head around it and I apologise and am embarrassed at being so dumb but it has been a long week!!!

1. UCD-SNMP-MIB::ssCpuRawIdle.0 -> Number of timeticks unused is a running total! this is important
2. - 1 * 100 / (delay between checks * number of timeticks per second * number of CPU) for Linux is calculated on the difference between data collection intervals. The Delta can never be more than for example (10 * 100 * 4)
3. you can therefore NOT calculate this on 1 single piece of data you need at least 2 and calculate it on the change.....

first collection value (A)= 1781085473
second collection value (B)= 1781088473
Delta (D)= 3000

(3000)*(1*100/(10*100*4)) = 75%

I think!! :)

grabber
05-07-2006, 19:42
It's hard to get a good reading for "ssCpuRawIdle" since a busy Zabbix server may not take a reading exactly at, for example, every 10 seconds. The % could go way out of whack, like to 300%.

I had to write a small command line script and place it in the snmpd.conf to get the CPU %.


can we get a copy of that script buddy?

Godzilla
12-07-2006, 09:32
I used mpstat to get the cpu %

also I added this to snmpd.conf:

exec cpuavg /bin/bash /etc/snmp/cpupct all
#exec cpu0 /bin/bash /etc/snmp/cpupct 0
#exec cpu1 /bin/bash /etc/snmp/cpupct 1
#exec cpu2 /bin/bash /etc/snmp/cpupct 2
#exec cpu3 /bin/bash /etc/snmp/cpupct 3



#!/bin/bash
#
# cpupct
#
# This returns the percent of CPU busy by subtracting 100 from % idle
#
# only accepts below
# all = avg of all CPU
#(for 2xCPU HyperThread)
# 0 = CPU 1a
# 1 = CPU 1b
# 2 = CPU 2a
# 3 = CPU 2b

if [ "$1" == all ] || [ "$1" == 0 ] || [ "$1" == 1 ] || [ "$1" == 2 ] || [ "$1" == 3 ]
then
passvar=$1
CPUidle=( `/usr/bin/mpstat -P ALL 1 1|/bin/grep Average|/bin/gawk "/$passvar /"'{print $9}'|/bin/sed 's/\.[0-9][0-9]*//'` )
CPUpct=`expr 100 - $CPUidle`
echo $CPUpct
exit 0
else
exit 1
fi
exit $?

grabber
13-07-2006, 14:21
Thanks

:)

patrickpeng
15-08-2006, 10:52
hello
I am a new user of zabbix-1.1, till now , I still do not know how to configure the snmp-agent, can anybody who can help me? With zabbix-agent, I can monitor it very well, but for snmp, do I need to install anything, and with snmp.conf, do I need to change anything. I created a new host, set its port to 161, let it link to SNMP_t, anything else to do? Please help me.

primos
16-08-2006, 11:59
But since the MIB definition is a STRING, I cannot graph the results.

manu_dbpur
09-11-2006, 16:44
Hi,
I configured following line in snmpd.conf file
extend <MIBIID> cpu /tmp/cpuutil to get cpu utilization.
and cpuutil file contains following line:
sar - u 1 | grep Average|awk '{print ($3 + $4 + $5 + $6)}'

But snmp is not giving proper values. Is this the bug in my code or in snmp. Please help to fix this bug.

Thanks,
Manu.V

dynax60
25-08-2010, 14:11
You can monitor CPU utilisation (%) with these OID :

Instant monitor, not an average :

UCD-SNMP-MIB::ssCpuRawUser.0 -> Number of timeticks used by users's process (AIX, Solaris, Linux, HP-UX)
UCD-SNMP-MIB::ssCpuRawSystem.0 -> Number of timeticks used by system's process (AIX, Solaris, Linux, HP-UX)
UCD-SNMP-MIB::ssCpuRawIdle.0 -> Number of timeticks unused (AIX, Solaris, Linux, HP-UX)
UCD-SNMP-MIB::ssCpuRawWait.0-> Number of timeticks used by process waiting (AIX, Solaris, HP-UX)
UCD-SNMP-MIB::ssCpuRawNice.0-> Number of timeticks used by nice process (Linux, HP-UX)
UCD-SNMP-MIB::ssCpuRawKernel.0 -> Number of timeticks used by kernel process (AIX, Solaris, Linux, HP-UX)

Configure the item with an OID, chose a custom multiplier of :
- 1 * 100 / (delay between checks * number of timeticks per second * number of CPU) for Linux
- 1 * 100 * number of CPU / (delay between checks * number of timeticks per second) for HP-UX
- 1 * 100 / (delay between checks * number of timeticks per second) for AIX and Solaris
store 'Delta Simple Change'.
To get the number of timeticks per second, use 'getconf CLK_TCK'. It's always 100 on hosts I've tested.
For example, with CLK_TCK=100 (Linux i386), check every 10 seconds, 2 CPU, the custom multiplier is 0.05.
For Linux, it's the logical number of CPU displayed by command 'top', not the physical number.



Could you help me with FreeBSD OS custom multiplier?
# getconf CLK_TCK
128

delay between checks is 30s.