Knowledge Base & Help Desk

SNMP Extensions explained
Posted by Ran Hartal | 2017-01-24 22:22:43
Posted by Ran Hartal
2017-01-24 22:22:43

SNMP extensions user guide

The following howto meant to help you understand Allprobe extensions structure, change extensions behavior and configure your own extensions located on your own repositories.

Extensions name format:

The name of the extension control the extension params, for exmaple:

Extension name - "APR-vmstat-cs" would mean

APR - extensions type (APR=allprobe, USR=user defined extension)

vmstat - the extension subject or set of values, this part also states the file name of the pulled extension,

So in this case if running the integrator, the exension will be pulled from allprobe repository

and be placed at /etc/apr/snmp/system/

Then pull

and be placed at /etc/apr/cron/system/

Configure the cron (this is cron based extension)

* * * * * root /bin/bash -c "/etc/apr/cron/system/; sleep 30 ; /etc/apr/cron/system/"

Configure SNMP configuration (e.g: /etc/snmp/snmpd.conf) by placing each extension as new extension, in this case:

extend APR-vmstat-cs /etc/apr/snmp/system/ cs

* A note on Linux cron based extensions - When the extension is based on Linux cron it would mean that the cron is running independently from the SNMP extensions, the cron is running and generating an output to text file placed at /etc/apr/buffer then when the extension file is running from SNMP daemon it reads this output already generated earlier by the cron. Why is it needed? Take the vmstat extension as an example for cron based extension, the Linux vmstat command generate few important values, by running this command once in the background we can place all those values in the extension buffer file, then the SNMP daemon and extensions can run many extensions in blocking mode and fetch those values fast, not running the expensive(in resources) vmstat over and over for each extension value. This way we keep resources footprint of the entire vmstat values. The Linux kernel caches files, which would mean that if the SNMP daemon is running ten extensions that need to read a value from the same extension buffer file, it would only read it once from disk then the rest of the reads would be from the cache, until generated again by the next run of the cron.

The value produced in this extension is the output of the command and is passed to the extension (this extension is reading the buffer file explained earlier):

/etc/apr/snmp/system/ cs

The argument "cs" is the third part of the extension name.

Other extensions options:

The following values can be configured for each extensions.

Croned / Not Croned:

Extensions supports 3 cron mode types:

1 - Not croned - There is no cron to support the CLI command run by SNMP daemon

2 - One cron foreach grouped category, there is a cron for each subject such as vmstat, there is 1 cron that producing all of the vmstat extensions values

So in the vmstat example there is many values produced by the cron and the CLI run from the SNMP daemon as extension will fetch each value with different argument, APR-vmstat-cs will get "Context Switches" , APR-vmstat-interrupts will get Interrupts


Programming language of the extension code / Python, Perl, Bash, PHP

This param controls the file extension and the way the extension will be running (default mode is bash, file extension  sh)


The repository of the extension - default value if not set is

So in the extension name "APR-vmstat-cs" which is croned (grouped type) and lang "BASH" the files fetched by the integrator or manualy will be

If you place it manualy then snmp file will have to go to:


and the cron file will be placed at:



Creating your own extensions:

1 - Need to decide the cron type of the extension

None croned, grouped cron, single cron

You set this by the exnesion properties. if we take the example extension vmstat mensioned above it is cron type of "grouped"

The vmstat extension based on the output of the vmstat command which has many values, we can re-use all of this values

In different argument passed by SNMP daemon.

The cron is configured to run once every 30 seconds by the integrator or manualy, then output is beeing written to a buffer file at:


The CLI that the SNMP daemon is calling is


Which is a simple BASH script that uses the buffer file created by the cron, thus just fast open with FS cache



case $1 in
        CMD=`cat $BUFFER/vmstat | awk '{print $13}'`
        CMD=`cat $BUFFER/vmstat | awk '{print $14}'`
        CMD=`cat $BUFFER/vmstat | awk '{print $15}'`
        CMD=`cat $BUFFER/vmstat | awk '{print $16}'`
        CMD=`cat $BUFFER/vmstat | awk '{print $12}'`
        CMD=`cat $BUFFER/vmstat | awk '{print $11}'`
        CMD=`cat $BUFFER/vmstat | awk '{print $7}'`
        CMD=`cat $BUFFER/vmstat | awk '{print $8}'`
        CMD=`cat $BUFFER/vmstat | awk '{print $9}'`
        CMD=`cat $BUFFER/vmstat | awk '{print $10}'`
        CMD=`cat $BUFFER/vmstat | awk '{print $1}'`
        CMD=`cat $BUFFER/vmstat | awk '{print $2}'`
        echo "Unknown argument"


if [ $? -eq 0 ]; then
    echo $OUTPUT
    echo "0"

The extension would then look like that on snmpd.conf when all uses the same script that uses the same buffer with category's values pre fetched:

extend APR-vmstat-so /etc/apr/snmp/system/ so
extend APR-vmstat-watime /etc/apr/snmp/system/ watime
extend APR-vmstat-user /etc/apr/snmp/system/ user
extend APR-vmstat-system /etc/apr/snmp/system/ system
extend APR-vmstat-running /etc/apr/snmp/system/ running
extend APR-vmstat-si /etc/apr/snmp/system/ si
extend APR-vmstat-bo /etc/apr/snmp/system/ bo
extend APR-vmstat-interrupts /etc/apr/snmp/system/ interrupts
extend APR-vmstat-blocked /etc/apr/snmp/system/ blocked
extend APR-vmstat-cs /etc/apr/snmp/system/ cs
extend APR-vmstat-bi /etc/apr/snmp/system/ bi

If it is user defined exension, simply replace APR with USR short for USER on the exension name,

The files of the exnesion(exension and / or cron) scripts are also placed in user folders e.g



How To's

  Check out AllProbe on mobile.