paulstuart/influxsnmp

Generic config to create dynamic tag-mappings

Opened this issue · 5 comments

In my past issue "snmp v1 without bulkrequests for mikrotik" the last problem was that the ifDescr-oid contains the important information, which port-name should be remembered as tag for all the counter-variables pulled by influxsnmp so that this tag can be saved into influxdb as a variable to distinguish the counters and map it to the correct switch-ports.

You changed the code so that the ifDescr-information is fetched if a if-mib is used.
I wonder if it would be possible to solve this kind of problem in a more generic way?

Because i now have the same problem if I want to collect informations about filesystems.
Example:

HOST-RESOURCES-MIB::hrStorageIndex.31 = INTEGER: 31
HOST-RESOURCES-MIB::hrStorageIndex.38 = INTEGER: 38
HOST-RESOURCES-MIB::hrStorageIndex.42 = INTEGER: 42

HOST-RESOURCES-MIB::hrStorageType.31 = OID: HOST-RESOURCES-TYPES::hrStorageFixedDisk
HOST-RESOURCES-MIB::hrStorageType.38 = OID: HOST-RESOURCES-TYPES::hrStorageFixedDisk
HOST-RESOURCES-MIB::hrStorageType.42 = OID: HOST-RESOURCES-TYPES::hrStorageFixedDisk

OST-RESOURCES-MIB::hrStorageDescr.31 = STRING: /
HOST-RESOURCES-MIB::hrStorageDescr.38 = STRING: /zones
HOST-RESOURCES-MIB::hrStorageDescr.42 = STRING: /usr

HOST-RESOURCES-MIB::hrStorageAllocationUnits.31 = INTEGER: 1024 Bytes
HOST-RESOURCES-MIB::hrStorageAllocationUnits.38 = INTEGER: 4096 Bytes
HOST-RESOURCES-MIB::hrStorageAllocationUnits.42 = INTEGER: 1024 Bytes

HOST-RESOURCES-MIB::hrStorageSize.31 = INTEGER: 268363
HOST-RESOURCES-MIB::hrStorageSize.38 = INTEGER: 195212
HOST-RESOURCES-MIB::hrStorageSize.42 = INTEGER: 442618

I have > 100 filesystems in my systems and i'm interessted in the hrStorageSize and hrStorageAllocationUnits. To be able to use influxsnmp for that kind of task, influxsnmp needs to write the hrStorageDescr-information into influxdb.

How can that be achieved in a more generic (configurable) way?

Add this to the mib section:

index = hrStorageDescr

It should add an index tag to each entry.

On Mon, Jun 6, 2016 at 5:44 AM, Christian Rost notifications@github.com
wrote:

In my past issue "snmp v1 without bulkrequests for mikrotik" the last
problem was that the ifDescr-oid contains the important information, which
port-name should be remembered as tag for all the counter-variables pulled
by influxsnmp so that this tag can be saved into influxdb as a variable to
distinguish the counter to switch-ports.

You changed the code so that the ifDescr-information is fetched if a
if-mib is used.
I wonder if it would be possible to solve this kind of problem in a more
generic way?

Because i now have the same problem if I want to collect informations
about filesystems.
Example:

HOST-RESOURCES-MIB::hrStorageIndex.31 = INTEGER: 31
HOST-RESOURCES-MIB::hrStorageIndex.38 = INTEGER: 38
HOST-RESOURCES-MIB::hrStorageIndex.42 = INTEGER: 42

HOST-RESOURCES-MIB::hrStorageType.31 = OID:
HOST-RESOURCES-TYPES::hrStorageFixedDisk
HOST-RESOURCES-MIB::hrStorageType.38 = OID:
HOST-RESOURCES-TYPES::hrStorageFixedDisk
HOST-RESOURCES-MIB::hrStorageType.42 = OID:
HOST-RESOURCES-TYPES::hrStorageFixedDisk

OST-RESOURCES-MIB::hrStorageDescr.31 = STRING: /
HOST-RESOURCES-MIB::hrStorageDescr.38 = STRING: /zones
HOST-RESOURCES-MIB::hrStorageDescr.42 = STRING: /usr

HOST-RESOURCES-MIB::hrStorageAllocationUnits.31 = INTEGER: 1024 Bytes
HOST-RESOURCES-MIB::hrStorageAllocationUnits.38 = INTEGER: 4096 Bytes
HOST-RESOURCES-MIB::hrStorageAllocationUnits.42 = INTEGER: 1024 Bytes
HOST-RESOURCES-MIB::hrStorageSize.31 = INTEGER: 268363
HOST-RESOURCES-MIB::hrStorageSize.38 = INTEGER: 195212
HOST-RESOURCES-MIB::hrStorageSize.42 = INTEGER: 442618

...


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#23, or mute the thread
https://github.com/notifications/unsubscribe/ADRjPQYNN1LCfMUflZNEd_1mbIso1ZCoks5qJBYzgaJpZM4Iu2vr
.

That would be great but in fact it is not working:

[common]
httpPort = 8085
mibs     = HOST-RESOURCES-MIB
mibfile  = /tmp/influxsnmp.json
elapsed  = false


[snmp "smartos"]
host      = 192.168.178.15
community = secret
port      = 161
timeout   = 20
freq      = 30
version   = 2
retries   = 3
mibs      = storage


[mibs "storage"]
name = hrStorageSize
index = hrStorageDescr

[influx "*"]
url        = http://influxdb:8086
database   = snmp1
influxsnmp -config config.cfg -sample -verbose
Host:192.168.178.15 Name:hrStorageSize Value:261775 (int/121.351213ms) Tags:
Host:192.168.178.15 Name:hrStorageSize Value:398614 (int/121.399967ms) Tags:
Host:192.168.178.15 Name:hrStorageSize Value:261887 (int/121.408282ms) Tags:
Host:192.168.178.15 Name:hrStorageSize Value:268363 (int/121.414446ms) Tags:
Host:192.168.178.15 Name:hrStorageSize Value:209531 (int/121.420628ms) Tags:
Host:192.168.178.15 Name:hrStorageSize Value:442618 (int/121.442717ms) Tags:
Host:192.168.178.15 Name:hrStorageSize Value:442618 (int/121.449417ms) Tags:
Host:192.168.178.15 Name:hrStorageSize Value:19616292 (int/121.455739ms) Tags:
Host:192.168.178.15 Name:hrStorageSize Value:19616292 (int/121.462023ms) Tags:
Host:192.168.178.15 Name:hrStorageSize Value:209323 (int/121.468031ms) Tags:
Host:192.168.178.15 Name:hrStorageSize Value:209337 (int/121.47414ms) Tags:
Host:192.168.178.15 Name:hrStorageSize Value:19616292 (int/121.48044ms) Tags:
Host:192.168.178.15 Name:hrStorageSize Value:19616292 (int/121.486506ms) Tags:
....

And

...
[mibs "storage"]
regexp = hrStorage.*
index = hrStorageDescr
...

is'nt working neither.

Very odd -- it works great for me.

If you change it to be

name = hrStorageSize hrStorageDescr

Does it pick it up as a value?

On Mon, Jun 6, 2016 at 8:15 AM, Christian Rost notifications@github.com
wrote:

That would be great but in fact it is not working:

[common]
httpPort = 8085
mibs = HOST-RESOURCES-MIB
mibfile = /tmp/influxsnmp.json
elapsed = false

[snmp "smartos"]
host = 192.168.178.15
community = secret
port = 161
timeout = 20
freq = 30
version = 2
retries = 3
mibs = storage

[mibs "storage"]
name = hrStorageSize
index = hrStorageDescr

[influx "*"]
url = http://influxdb:8086
database = snmp1

influxsnmp -config config.cfg -sample -verbose
Host:192.168.178.15 Name:hrStorageSize Value:261775 (int/121.351213ms) Tags:
Host:192.168.178.15 Name:hrStorageSize Value:398614 (int/121.399967ms) Tags:
Host:192.168.178.15 Name:hrStorageSize Value:261887 (int/121.408282ms) Tags:
Host:192.168.178.15 Name:hrStorageSize Value:268363 (int/121.414446ms) Tags:
Host:192.168.178.15 Name:hrStorageSize Value:209531 (int/121.420628ms) Tags:
Host:192.168.178.15 Name:hrStorageSize Value:442618 (int/121.442717ms) Tags:
Host:192.168.178.15 Name:hrStorageSize Value:442618 (int/121.449417ms) Tags:
Host:192.168.178.15 Name:hrStorageSize Value:19616292 (int/121.455739ms) Tags:
Host:192.168.178.15 Name:hrStorageSize Value:19616292 (int/121.462023ms) Tags:
Host:192.168.178.15 Name:hrStorageSize Value:209323 (int/121.468031ms) Tags:
Host:192.168.178.15 Name:hrStorageSize Value:209337 (int/121.47414ms) Tags:
Host:192.168.178.15 Name:hrStorageSize Value:19616292 (int/121.48044ms) Tags:
Host:192.168.178.15 Name:hrStorageSize Value:19616292 (int/121.486506ms) Tags:
....


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#23 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/ADRjPeKt63_n0QCpwugqJOuGHaQj1mQOks5qJDmugaJpZM4Iu2vr
.

Yes with:

[mibs "storage"]
name = hrStorageSize hrStorageDescr

influxsnmp -config config.cfg -sample -verbose
Host:192.168.178.15 Name:hrStorageDescr Value:Physical memory (string/25.52346ms) Tags:
Host:192.168.178.15 Name:hrStorageDescr Value: Virtual memory (string/26.161069ms) Tags:
Host:192.168.178.15 Name:hrStorageDescr Value:Swap space (string/26.17685ms) Tags:
Host:192.168.178.15 Name:hrStorageDescr Value:/ (string/26.184928ms) Tags:
Host:192.168.178.15 Name:hrStorageDescr Value:/etc/svc/volatile (string/26.193358ms) Tags:
Host:192.168.178.15 Name:hrStorageDescr Value:/usr (string/26.200831ms) Tags:
Host:192.168.178.15 Name:hrStorageDescr Value:/lib/libc.so.1 (string/26.207661ms) Tags:
Host:192.168.178.15 Name:hrStorageDescr Value:/etc/shadow (string/26.214784ms) Tags:
...

Host:192.168.178.15 Name:hrStorageSize Value:261775 (int/22.692301ms) Tags:
Host:192.168.178.15 Name:hrStorageSize Value:392802 (int/22.724497ms) Tags:
Host:192.168.178.15 Name:hrStorageSize Value:261887 (int/22.732512ms) Tags:
Host:192.168.178.15 Name:hrStorageSize Value:268363 (int/22.739581ms) Tags:
Host:192.168.178.15 Name:hrStorageSize Value:208793 (int/22.745888ms) Tags:
...

With:

[mibs "storage"]
name = hrStorageSize hrStorageDescr
index = hrStorageDescr...

the output is reversed: At first the hrStorageSize - lines and then the hrStorageDescr - lines.
The same output with

[mibs "storage"]
name = hrStorageDescr hrStorageSize
index = hrStorageDescr

It's not clear why it doesn't work for you. I'm going to have to meditate
upon this....

On Mon, Jun 6, 2016 at 9:04 AM, Christian Rost notifications@github.com
wrote:

Yes with:

[mibs "storage"]
name = hrStorageSize hrStorageDescr

influxsnmp -config config.cfg -sample -verbose
Host:192.168.178.15 Name:hrStorageDescr Value:Physical memory
(string/25.52346ms) Tags:
Host:192.168.178.15 Name:hrStorageDescr Value: Virtual memory
(string/26.161069ms) Tags:
Host:192.168.178.15 Name:hrStorageDescr Value:Swap space
(string/26.17685ms) Tags:
Host:192.168.178.15 Name:hrStorageDescr Value:/ (string/26.184928ms) Tags:
Host:192.168.178.15 Name:hrStorageDescr Value:/etc/svc/volatile
(string/26.193358ms) Tags:
Host:192.168.178.15 Name:hrStorageDescr Value:/usr (string/26.200831ms)
Tags:
Host:192.168.178.15 Name:hrStorageDescr Value:/lib/libc.so.1
(string/26.207661ms) Tags:
Host:192.168.178.15 Name:hrStorageDescr Value:/etc/shadow
(string/26.214784ms) Tags:
...

Host:192.168.178.15 Name:hrStorageSize Value:261775 (int/22.692301ms) Tags:
Host:192.168.178.15 Name:hrStorageSize Value:392802 (int/22.724497ms) Tags:
Host:192.168.178.15 Name:hrStorageSize Value:261887 (int/22.732512ms) Tags:
Host:192.168.178.15 Name:hrStorageSize Value:268363 (int/22.739581ms) Tags:
Host:192.168.178.15 Name:hrStorageSize Value:208793 (int/22.745888ms) Tags:
...

With:

[mibs "storage"]
name = hrStorageSize hrStorageDescr
index = hrStorageDescr...

the output is reversed: At first the hrStorageSize - lines and then the
hrStorageDescr - lines.
The same output with

[mibs "storage"]
name = hrStorageDescr hrStorageSize
index = hrStorageDescr


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#23 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/ADRjPZDXr2G2O4bWbTghSLhPmzAGr-fpks5qJEUNgaJpZM4Iu2vr
.