opensolutions/OSS_SNMP — pull request #6 by thomas-mangin (2014-07-03 09:54:28+00:00)
Title: add linux / cumulus support

This is a slightly modified version of what I used to be able to get IXLeeds Cumulus switches SNMP discovered. As I saw a feature request for generic Linux, I also added it, it was not tested but the regex works:

> snmpwalk -c -On -v 2c 127.0.0.1 .1.3.6.1.2.1.1.1.0
.1.3.6.1.2.1.1.1.0 = STRING: "Linux ixleeds1 3.11.0-23-generic #40-Ubuntu SMP Wed Jun 4 21:05:23 UTC 2014 x86_64"

>>> print re.compile('Linux ([^ ]+) ([^ ]+)-([^ ]+) #[^ ]+-([^ ]+) SMP ([^ ]+) ([^ ]+) ([^ ]+) ([^ ]+) ([^ ]+) ([^ ]+) (.*)').search('Linux ixleeds1 3.11.0-23-generic #40-Ubuntu SMP Wed Jun 4 21:05:23 UTC 2014 x86_64').groups()
('ixleeds1', '3.11.0-23', 'generic', 'Ubuntu', 'Wed', 'Jun', '4', '21:05:23', 'UTC', '2014', 'x86_64')