Polling
strategy and Script files.
The goal of this How to
is to provide to LoriotPro users more information on the polling process
and the polling strategies.
Before stating a polling
campaign, you should know what you want to measure and have
an idea of how the SNMP object changes over the time.
Finding the SNMP object you want to measure.
Here we use an example
of a network interface. We want to measure at regular interval
how much octets go in and out of this interface.
Get the interface instance
from the simple query tool by clicking on one of the interface,
you then get the list of interfaces and the ifindex
of the interface.
Creating the SCRIPT file
A script file is a simple
text file that contains the list of objects and their index,
polled according to the polling interval. The extension
of this file are .sci.
Use the Mib
Scripter tool to create your sci
file and/or a simple editor.
In our example we decide
to collect the sysname, sysuptime of the equipment
and the ifinoctet, ifoutoctet values of
a specific network interface. The sysuptime value is required
if calculations have to be made over a time period.
The
sysuptime value is available in
the mib2.
OID LEN (8)
: 1.3.6.1.2.1.1.3.
iso(1).org(3).dod(6).internet(1).mgmt(2).mib-2(1).system(1).sysuptime(3).sysuptimeinstance(0)
Definition: "The
time (in hundredths of a second) since the network management
portion of the system las last re-initialized."
Example of sci
file:
sysname
sysuptime
ifinoctets.3
ifoutoctets.3 Using the
Script file
The script file can be
used in the the Host properties windows.
In the example below you
see the sci file that is loaded
Use the Load polling
script to select your script file and
check the box Out CSV.
The result will be save in a csv file in the www/log under the the
poll_name_date format.
You will have in our example
a file generated for each day containing the values of interface
in octets and out octets taken each minute.
Exemple : poll_128.1.1.1__Oct_03_2003.csv
The
data are separated by comma (csv format)
- The date
- The timestamp added by LoriotPro
- The sysname of the host
- The time since last boot
- The ifinoctets of the interface
- The ifoutoctets of the interface
The csv
file looks like this:
| Fri
Oct 03 09:43:57 2003;1065199437;Achille;336022;3644155;49487; |
| Fri
Oct 03 09:46:00 2003;1065199560;Achille;348241;3783599;50733; |
| Fri
Oct 03 09:47:01 2003;1065199621;Achille;354437;3855909;51384; |
| Fri
Oct 03 09:48:02 2003;1065199682;Achille;360512;3925087;52007; |
| Fri
Oct 03 09:49:03 2003;1065199743;Achille;366627;3995329;52630; |
| Fri
Oct 03 09:50:04 2003;1065199804;Achille;372703;4064531;53253; |
| Fri
Oct 03 09:51:05 2003;1065199865;Achille;378818;4134709;53876; |
| Fri
Oct 03 09:52:06 2003;1065199926;Achille;384934;4204951;54499; |
| Fri
Oct 03 09:53:07 2003;1065199987;Achille;391012;4276108;55172; |
| Fri
Oct 03 09:54:08 2003;1065200048;Achille;397125;4345545;55795; |
| Fri
Oct 03 09:55:10 2003;1065200110;Achille;403240;4414747;56720; |
| Fri
Oct 03 09:56:12 2003;1065200172;Achille;409438;4487057;57371; |
| Fri
Oct 03 09:57:12 2003;1065200232;Achille;415514;4556235;57994; |
| |
Using the results
To calculate the number
of octets received between each polling, it is necessary to check that the counter
has not been reset between two pollings or that it has not
wrapped.
A counter wraps when it
reaches its maximum value (counter max value),
this could occur frequently on high speed links. You can
use the following table to get an idea of time between polling
to set if the line is used at a theoretically full speed.
We assume that the counter
contains octets and not bits (like the ifinoctet
SNMP object)
The max value of a 32
bit counter is : 4 294 967 296 (octets)
The max value of a 64 bit counter
is : 1.8 10e19 (octets)
| 32
bit counters |
Counter
wrap each : |
64
bits counters |
Counter
wrap each : |
| 10
Mbps |
57,26
minutes |
|
|
| 100
Mbps |
5,73
minutes |
|
|
| 155
Mbps |
3,69
minutes |
|
|
| 1
Gig |
34
seconds |
|
|
| |
|
1
Tera |
2459565
minutes |
If your link is
loaded you should imperatively define a polling interval
to avoid this case. The polling interval should be inferior
to the worst case, in our example below 5,7
minutes. If possible, increase the polling period to a ratio
of 4 of the counter wrap time.
We could imagine the simple
case below:
We voluntary set for the
example a theoretically fully loaded Ethernet after the
second counter restart
The
raw data of the counter would be:
| Poll
event |
Raw
value |
| Poll
t1 |
3 700 000
000 |
| Poll
t2 |
3
850 000 000 |
| Poll
t3 |
1 200 000
000 |
| Poll
t4 |
800 000
000 |
To calculate the number
of real data exchanged, some calculations are necessary.
The following formula
gives you the number of octets transmitted for a polling
interval.
raw value (t) – raw value (t-1)
The sum of these results
on the needed interval period (hour), day, month etc..
would give you the number of octets transmitted over that
period.
But if the raw value
(t) – raw value (t-1) is negative the counter
has wrapped. Notice that it is one way to be sure that the
counter has wrapped. It is
indeed important to notice that the result of the calculation
raw value (t) – raw value (t-1) can be positive
tough the counter has wrapped.
In case the calculation
is negative, you should then calculate the amount of data
with the formula:
raw value (t) + (counter max value – raw value (t-1))
In our example, the real
values are
| Formula |
|
| (Poll
t0 raw value) – (Poll t1 raw value) |
3 700 000 000
– 0 = 3 700 000 000 |
| (Poll
t2 raw
value) + (counter max – (Poll t1 raw
value)) |
3
850 000 000 + (4 294 967 296 - 3 700 000 000)
|
| (Poll
t3 raw
value) + (counter max – (Poll t2 raw
value)) |
1 200 000 000
+ (4 294 967 296 - 3 850 000 000) |
| (Poll
t4 raw
value) + (counter max – (Poll t3 raw
value)) |
800 000 000
+ (4 294 967 296 - 1 200 000 000) |
And if Sysuptime(t)-sysuptime(t-1) is negative the equipment has restarted. The
formula is not valid anymore. Use the raw value (t)
value as value, you have lost anyway the data value between
the last polling and the shutdown.
The throughput in octets/s
can be calculated for each polling interval by the formula:
raw value (t) – raw value (t-1)
Sysuptime(t) - Sysuptime(t-1)
Or when the counter wraps
raw value(t) + (counter max –
(raw value( t-1)))
Sysuptime(t) - Sysuptime(t-1)
We have to read the Sysuptime
value (the time since the equipment has been started) to
avoid an eventual time skew introduced by the network delay
between the SNMP request and the response. This is necessary
if you want to calculate a precise throughput.
end of document |