-
Notifications
You must be signed in to change notification settings - Fork 56
Home
SnmpCollector is an Open Source tool and is full featured Generic SNMP data collector with Web Administration Interface which has as main goal simplify the configuration for getting data from any device witch snmp protocol support and send resulting data to a influxdb.
These are the features for the snmp agent and the webui embedded tool
- SNMP versions 1, 2/2c, 3
- Support for gather any SNMP (SMI) data type.
- Support for cooked counters , can compute increments and/or rate conversion
- Support for cooked STRINGS to get any sub-string as integer
- Support for cooked Process data from previously gathered data (these are the supported expressions )
- Gather of SNMP Scalar an Tabular values.
- Support for filtering table rows, based on snmp data conditions (OIDConditions)
- Support for table row filtering,based on fixed rules (fileConditions) --compatibility with influxsnmp tool--
- Support for custom filters from any table (online selectable via webUI)
- Support for multiple conditions (combined in evaluated expressions)
- Support for Override column aliases with custom labels
- Send self monitoring stats to any influxdb
- Support for Influxdb > 1.0
- SQLite/MySQL SQL based configuration
- influxdb complete customized measurements,field and tag names
- Metric OID Condition Counter (to send only counted results of OID conditions)
- Complete configuration Interface for all objects
- Snmp web console as snmpget/snmpwalk replacement
- Automatic snmp connectivity check
- Online Runtime data viewer for all gathered metrics.
- Online Configuration reload
- Online device activation/deactivation , and log
- REST API support
- Configuration for Import and Export
- Automatic OID lookup and form completion from MIB database
- token based authentication to enable Remote Authentication via REST API
Head to and download the latest release and Install the suitable package for your distribution
Debian | RedHat |
---|---|
deb - signature | rpm - signature |
You can see a list of features and changes in the ChangeLog
Check an feel free to change any of the predefined parameters in the main configuration placed in /etc/snmpcollector/config.toml
############################
# General Config
############################
[general]
# InstanceID will be a string identifying the collector , It will be useful when
# more than one running on the same server, this ID will be shown in the WebUI.
instanceID = "WAN Communicactions"
# datadir set the directory where the data will be placed , also sqlite db if set as db engine
# if not set the default datadir will be placed in the configuration directory
# datadir = "/var/lib/snmpcollector"
# there are as many logs as devices configured
# logdir set the Directory path for each device individual log, default is /var/log/snmpcollector
# logdir = "/var/log/somelogpath"
# NOTE: main process log is now sent to standard output
# logLevel set the main process log level
# valid values: panic,fatal,error,warn,info,debug
logLevel = "warn"
############################
# DataBase Config
############################
[database]
#type sets the sql backend , valid values sqlite3,mysql
type = "sqlite3"
# these parameters are only for mysql
# host = 127.0.0.1:3306
# user = "root"
# password = ""
# name sets the database name
name = "snmpcollector"
# sqllogfile sets the name for a file in the log/ directory where sql backend will write all SQL transactions
# sqllogfile = "sql.log"
# debug adds extra verbosity to the SQL log
debug = false
############################
# Self Monitorig Config
############################
#config for sending self monitoring metrics to our default influx db
# Sent Measurements will be <prefix>selfmon_gvm with the following fields
# runtime_goroutines
# *mem.alloc
# *mem.mallocs
# *mem.frees
# *gc.total_pause_ns
# *memory.heap
# *gc.pause_per_second
# *gc.pause_per_interval
# *gc.gc_per_second
# *gc.gc_per_interval
[selfmon]
#enable true/false enable/disable self monitoring
enabled = true
#send data Frequency
freq = 60
#prefix for measurement naming
prefix = ""
#adds extra tags to the measurement config should be set as a csv - tag=value1,tag2=value2,...,tagN=valN
extratags = [ "instance=snmpcollector01" ]
############################
# Embedded WebServer Config
############################
[http]
#port where webserver will listen waiting for connections
port = 8090
#Admin credentials to access to the SnmpCollector agent
adminuser = "adm1"
adminpassword = "adm1pass"
#When more than one instance you will need customize the cookie_id allowing navigate to all instances
cookieid ="my_instance_cookie"
After that you will be able to start an snmpcollector agent instance with a zero configuration (without devices or metric definitions).
If you have any problems please open issue to the snmpcollector team
Open the url http://your_snmpcollector_agent_host:8090/
You will be prompted to insert valid credentials.
Once logged you will see the main Runtime view with a list of devices and it's state.
snmpcollector has not yet support for different users with customized Access control , right now It has only one administrative user that can be customized into the [database] config.toml section with full access to all devices, configurations, runtime , console
Fist you need is create a new Influxdb output database.
In the Influx servers list click on new.
These are the following parameters, that let you create an HTTP based Influxdb Connection
Config Parameter | Description |
---|---|
id | Text String that uniquely identify the influxdb connection |
Host | the hostname/IP to connect |
Port | the port to connect |
DB | the influxdb Database |
User | the user which you need to login to the influx db |
Password | a valid password |
Retention Policy | the database retention policy |
Timeout | |
User Agent | HTTP user agent sent to the database backend ( useful to debug input data from de backend view), if not set the agent will send as user agent snmpCollector-<InstanceID> (from the [general] config.toml section) |
Description | some useful description to administrators |
On first execution , there is not any database configured, and anyway you could add devices and restart agent. In this scenario a internal "dummy Server" is created to send data from all gathered devices, and finally this dummy server will discard them.
SnmpCollector is able to send its own stats to a InfluxDB , It will look for a influx-server named "default" to use as output backend, if doesn't exist It will send over the Dummy Server.
(Pending define default and dummy influxservers)
At the metric config view
click on new and will appear the following form:
Config Parameter | Description |
---|---|
id | Text String that uniquely identify the metric recommended use the MIB Name, should be unique in the database |
fieldName | set the "field" name inside a Influx measurement, could be the same of id or not, should be unique inside the measurement where the metric will be sent. |
isTag | If true data will be sent as a Influxdb "TAG". (default is false) |
baseOID | Snmp OID for this metric ( could be the base OID when it belongs to a snmp indexed table), could not be set only if datasrctype is of type "String Eval". |
DataSrcType | Origin data type could be one of these:
|
ExtraData | data needed to special data types as String Eval(evaluated expression needed) or String Parser(regex needed) |
GetRate | Only useful on counter types , if true value sent will be the computed difference and after divided by the number of elapsed seconds between snmp calls |
Scale | if set (as a floating point value) computed data will be scaled before sent. |
Shift | if set (as a floating point value) computed data will be shifted before sent. |
Description | any useful discretion to understand data gathered for this metric ( recommended place here units of the measurement). |
The SnmpCollector Metric engine computes all its data and sent them as floating point values to the database, except for tags that will be sent as text strings
Measurements are the basic Influxdb structure let us group series of the same type/origin.
When data are gathered from SNMP devices we can group them together as we wish when snmp data are scalar objects but is mandatory group snmp tabular objects in the same measurement.
On the measurement view click new and you will see a form that you will use to create measurements.
These are the main configuration parameters
Config Parameter | Description |
---|---|
id | Text String that uniquely identify the measurement recommended use the MIB Name prefixed/suffixed with some other string data we can easily identify (as manufacturer or model) that will help us to look in the Measurement config section, should be unique in the database |
Name | This will be the Measurement name created in the Database when sending data, will let us to query data with "SELECT * from ..." |
GetMode |
|
IndexOID | (only required for SNMP Table based data) The OID will be queried to get row Tag Values of the table. |
TagOID | (only required for SNMP indirect Tag based data) the OID will be queried to get TAG value names from other table. |
IndexTAG | (only required for SNMP Table based data) the tag name will be sent to distinguish among different rows. |
IndexTAGFormat | (only required for SNMP Table based data) enable custom format for TAGS based on parameters from values and indexes from IndexOID ( parameters as $IDX1 and $VAL1) or TagOID when measurement is defined as indirect indexes defined ( parameters $IDX2 and $VAL2). Default format is $VAL1 for direct indexed tables and $VAL2 for indirect indexed. example: [$IDX1]-$VAL1 will be sent as tag a "[2]-eth2" |
IndexAsValue | (only required for SNMP Table based data) if true we will send TagValue direct from the numeric Index (useful with tables without string names -- Some IBM disk arrays has this kind of tables--) |
Fields | A list of metricID which will be part of this measurement and what to do with the value.
|
A Measurement Group is a collection of measurements, and its main goal is to act as a "Product" or "Device Model" Template. Once defined should be easy creating new devices and only adding this measurement group. You can add as many measurements as you wish.
Config parameters are
Config Parameter | Description |
---|---|
id | Text String that uniquely identify the measurement group recommended use the Product/Device Name/model as , should be unique in the database |
Measurements | A list of measurement id's |
Description | A description text for the measurement group. |
Filters has only sense over indexed measurements (snmp tables), the goal of these filters are limit the amount of data sent to the backend, and it will be related to the data contained in the measurement, so it will be applied only to the selected measurement
In the above list you could see a filter_port_if_status_up
defined as a condition over and OID. Only indexes which will match the condition will be selected to send data to the database backend.
Filter and Re-Indexing measurements are performed periodically and controlled by the "Update Filter" device parameter
There is two filter types.
It will apply a logical condition over the result of a snmp query over an OID.
It will apply filtering over the indexes of the measurement taken as values an input file
File must a TXT file placed at the config directory with the following scheme.
#this is a comment
eth0
#following interface has a name defined as an alias
eth2 backup_net
sit0
_This filter mode is mainly maintained for compatibility with the influxsnmp tool, it is planned for 1.0 version to create a similar custom filtering from the webUI and stored over the database _
These are all parameters.
Config Parameter | Description |
---|---|
id | Text String for each |
MeasurementID | The measurement on which filter could be applied if selected in the device. |
Filter Type |
|
File Name | (Only apply on the File Filter type) the file name by example ("my_filer_file_for_device_xxxxx.txt") |
Enable Alias | (Only apply on the File Filter type) after filtering it takes 2on column if defined as a TAG for the measurement better than the original name ( in the first column) |
OID condition | (Only apply on the OID Condition Filter type) the OID will be used to get and evaluate data. |
Condition Type | These are all possible conditions
|
Condition Value | the number or regex will apply to filter result from queried snmp OID's |
Over the list view click on New button
And a big form with a lot of option will appear.
These are the parameters
Config Parameter | Description |
---|---|
id | Text String that uniquely identify the device , should be unique in the config db, it can be hostname, serial number or any other text id |
host | the network direction the agent will use to do snmp connection , could be IP or fqdn name |
port | the network port where the agent will use to do snmp connections |
snmpversion | could be any of these [1,2c,3] |
disable snmpbulk | if true the bulk feature won't be used ( these feature is needed to query IBM XIV disk arrays, which has a snmpv2/v3 agent with a buggy bulk support) |
community | the snmp version 2 community |
v3seclevel | (only for snmpv3) define the level of security needed for the connection valid values are.
|
v3authuser | (snmpv3 only) the username that will establish the snmp query |
v3authpass | (snmpv3 only) the authentication password |
v3authprot | (snmpv3 only) the Authentication Protocol values should be any of "MD5", "SHA" |
v3privpass | (snmpv3 only) Privacy password |
v3privprot | (snmpv3 only) Privacy Protocol values should be any of [ "DES", "AES"] |
freq | Frequency of polling in seconds ( default 30 sec if not set) |
FilterUpdate | Number pof complete polls that agent will wait before perform snmp table index/filter updates , the final update time will be Freq*FilterUpdate ( in seconds) Default 1h |
DeviceTagName | Tag name the agent will send to the output db (default : "device"), could be any of the other more explicit tagname depending on the device type, context , by example (router,switch,firewall,dns..etc) |
DeviceTagValue | could be one of these:
|
ExtraTags | an array of tags for this device that will be sent on all its measurements. |
Measurement Groups | an array of Measurement Group ID. |
Filters | an array for configured filters |
Snmpcollector has an embedded online device state and data measurement viewer, which help us to monitor how data has been gathered for each device. On the device list you will see if device is active or have been stoped by the administrator. You can also see if there is any connectivity problems
On the eye icon you will see both state and number of measurements/metrics configured on that device