Add basic support for PICA8 devices (#11185)

* mib

* os_support

* polling

* tests

* codeclimate
This commit is contained in:
PipoCanaja 2020-02-26 01:28:56 +01:00 committed by GitHub
parent 13e6a38ee4
commit 3742e4f7ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 18256 additions and 0 deletions

BIN
html/images/os/picos.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -0,0 +1,20 @@
mib: PICA-PRIVATE-MIB
modules:
processors:
data:
-
oid: cpuUsage
num_oid: '.1.3.6.1.4.1.35098.1.1.{{ $index }}'
sensors:
fanspeed:
data:
-
oid: rpsuFanSpeed
num_oid: '.1.3.6.1.4.1.35098.1.11.1.5.{{ $index }}'
descr: 'PSU {{ $index }} Fan Speed'
index: 'psufanspeed{{ $index }}'
-
oid: switchFanSpeed
num_oid: '.1.3.6.1.4.1.35098.1.8.{{ $index }}'
descr: 'Switch {{ $index }} Fan Speed'
index: 'swfanspeed{{ $index }}'

View File

@ -0,0 +1,11 @@
os: picos
text: 'Pica8 OS'
type: network
over:
- { graph: device_bits, text: Traffic }
- { graph: device_processor, text: 'CPU Usage' }
icon: picos
discovery:
-
sysObjectID:
- .1.3.6.1.4.1.35098

View File

@ -0,0 +1,29 @@
<?php
/*
* LibreNMS
*
* Copyright (c) 2015 Søren Friis Rosiak <sorenrosiak@gmail.com>
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
preg_match("/ for ([^\s]*)/m", $device['sysDescr'], $matches);
if (!empty($matches[1])) {
$hardware .= trim($matches[1]);
}
$oidList = [
'PICA-PRIVATE-MIB::hostStatusGroup.16.0',
];
foreach ($oidList as $oid) {
$serial_tmp = snmp_get($device, $oid, '-OQv');
if (!empty($serial_tmp)) {
$serial = $serial_tmp;
break;
}
}

381
mibs/picos/PICA-PRIVATE-MIB Normal file
View File

@ -0,0 +1,381 @@
PICA-PRIVATE-MIB DEFINITIONS ::= BEGIN
IMPORTS
MODULE-IDENTITY, OBJECT-TYPE, Counter32, Gauge32, Counter64,
Integer32, TimeTicks, mib-2, snmpModules,IpAddress,
NOTIFICATION-TYPE FROM SNMPv2-SMI
TEXTUAL-CONVENTION, DisplayString,
PhysAddress, TruthValue, RowStatus,
TimeStamp, AutonomousType, TestAndIncr FROM SNMPv2-TC
MODULE-COMPLIANCE, OBJECT-GROUP,
NOTIFICATION-GROUP FROM SNMPv2-CONF
snmpTraps FROM SNMPv2-MIB
IANAifType FROM IANAifType-MIB
enterprises FROM RFC1155-SMI;
picaPrivateMib MODULE-IDENTITY
LAST-UPDATED "201104280000Z"
ORGANIZATION "Pica8 Inc."
CONTACT-INFO
" Customer Support
E-Mail: support@pica8.com
WWW: http://www.pica8.com"
DESCRIPTION
"The MIB module to manage Pica8's Pronto product."
REVISION
"201104280000Z"
DESCRIPTION
"The Pica8 Private MIB, Initial Version.
Author: Robin Wan."
::= { enterprises 35098 }
hostStatusGroup OBJECT IDENTIFIER ::= { picaPrivateMib 1 }
cpuUsage OBJECT-TYPE
SYNTAX INTEGER(0..100)
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"The usage of CPU, the output format is integer."
::= { hostStatusGroup 1 }
totalPhyMemory OBJECT-TYPE
SYNTAX DisplayString
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"The total physical memory size, the output format is string."
::= { hostStatusGroup 2 }
usedPhyMemory OBJECT-TYPE
SYNTAX DisplayString
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"The used physical memory size, the output format is string."
::= { hostStatusGroup 3 }
freePhyMemory OBJECT-TYPE
SYNTAX DisplayString
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"The free physical memory size, the output format is string."
::= { hostStatusGroup 4 }
switchTemperature OBJECT-TYPE
SYNTAX DisplayString
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"The temperature of switch, the output format is integer."
::= { hostStatusGroup 5 }
cpuTemperature OBJECT-TYPE
SYNTAX DisplayString
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"The teperature of CPU, the output format is integer."
::= { hostStatusGroup 6 }
switchChipTemperature OBJECT-TYPE
SYNTAX DisplayString
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"The teperature of switch chip."
::= { hostStatusGroup 7 }
switchFanSpeed OBJECT-TYPE
SYNTAX DisplayString
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"The fan speed of switch chip."
::= { hostStatusGroup 8 }
switchPWM OBJECT-TYPE
SYNTAX DisplayString
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Pulse Width Modulation(PWM) of switch chip."
::= { hostStatusGroup 9 }
sfpstatusTable OBJECT-TYPE
SYNTAX SEQUENCE OF SfpstatusEntry
MAX-ACCESS not-accessible
STATUS current
DESCRIPTION
"A list of sfp moudule status entries."
::= { hostStatusGroup 10 }
sfpstatusEntry OBJECT-TYPE
SYNTAX SfpstatusEntry
MAX-ACCESS not-accessible
STATUS current
DESCRIPTION
"An entry containing all sfp module stauts"
INDEX { sfpIndex }
::= { sfpstatusTable 1 }
SfpstatusEntry ::=
SEQUENCE {
sfpIndex INTEGER,
sfpVendorName DisplayString,
sfpSerialNumber DisplayString,
sfpTemp DisplayString,
sfpVoltage DisplayString,
sfpBias DisplayString,
sfpTxPower DisplayString,
sfpRxPower DisplayString,
sfpType DisplayString
}
sfpIndex OBJECT-TYPE
SYNTAX INTEGER (1..2147483647)
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"The port number of interface."
::= { sfpstatusEntry 1 }
sfpVendorName OBJECT-TYPE
SYNTAX DisplayString
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"The vendor name of sfp ransceiver transfer."
::= { sfpstatusEntry 2 }
sfpSerialNumber OBJECT-TYPE
SYNTAX DisplayString
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"The serial number of sfp ransceiver transfer."
::= { sfpstatusEntry 3 }
sfpTemp OBJECT-TYPE
SYNTAX DisplayString
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"The temperature of sfp ransceiver transfer."
::= { sfpstatusEntry 4 }
sfpVoltage OBJECT-TYPE
SYNTAX DisplayString
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"The voltage of sfp ransceiver transfer."
::= { sfpstatusEntry 5 }
sfpBias OBJECT-TYPE
SYNTAX DisplayString
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"The bias current of sfp ransceiver transfer."
::= { sfpstatusEntry 6 }
sfpTxPower OBJECT-TYPE
SYNTAX DisplayString
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"The Tx power of sfp ransceiver transfer(dBm)."
::= { sfpstatusEntry 7 }
sfpRxPower OBJECT-TYPE
SYNTAX DisplayString
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"The Rx power of sfp ransceiver transfer(dBm)."
::= { sfpstatusEntry 8 }
sfpType OBJECT-TYPE
SYNTAX DisplayString
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"The type of sfp ransceiver transfer(dBm)."
::= { sfpstatusEntry 9 }
rpsustatusTable OBJECT-TYPE
SYNTAX SEQUENCE OF RpsustatusEntry
MAX-ACCESS not-accessible
STATUS current
DESCRIPTION
"A list of Redundancy power supply unit(RPSU) status entries."
::= { hostStatusGroup 11 }
rpsustatusEntry OBJECT-TYPE
SYNTAX RpsustatusEntry
MAX-ACCESS not-accessible
STATUS current
DESCRIPTION
"An entry containing all Redundancy power supply unit(RPSU) stauts."
INDEX { rpsuIndex }
::= { rpsustatusTable 1 }
RpsustatusEntry ::=
SEQUENCE {
rpsuIndex INTEGER,
serialNumber DisplayString,
rpsuStatus INTEGER,
rpsuTemprature DisplayString,
rpsuFanSpeed INTEGER,
rpsuPWM DisplayString
}
rpsuIndex OBJECT-TYPE
SYNTAX INTEGER(0..10)
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"The slot number Redundancy power supply unit(RPSU)."
::= { rpsustatusEntry 1 }
serialNumber OBJECT-TYPE
SYNTAX DisplayString
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"The serial number Redundancy power supply unit(RPSU)."
::= { rpsustatusEntry 2 }
rpsuStatus OBJECT-TYPE
SYNTAX INTEGER (0..1)
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"The status of Redundancy power supply unit(RPSU).
1: The Redundancy power supply unit(RPSU) power on.
0: The Redundancy power supply unit(RPSU) power off."
::= { rpsustatusEntry 3 }
rpsuTemprature OBJECT-TYPE
SYNTAX DisplayString
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Temprature of the Redundancy power supply unit(RPSU)."
::= { rpsustatusEntry 4 }
rpsuFanSpeed OBJECT-TYPE
SYNTAX INTEGER(1..2147483647)
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Fan speed of the Redundancy power supply unit(RPSU)."
::= { rpsustatusEntry 5 }
rpsuPWM OBJECT-TYPE
SYNTAX DisplayString
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Pulse Width Modulation(PWM) of the Redundancy power supply unit(RPSU)."
::= { rpsustatusEntry 6 }
switchConfigGroup OBJECT IDENTIFIER ::= { picaPrivateMib 2 }
tftpConfigFilePath OBJECT-TYPE
SYNTAX OCTET STRING (SIZE (2..255))
MAX-ACCESS read-write
STATUS current
DESCRIPTION
"If the tftp path of defined config file is set, the configurations
included in the config file are also applied meanwhile. "
::= { switchConfigGroup 0 }
tftpBatchFilePath OBJECT-TYPE
SYNTAX OCTET STRING (SIZE (2..255))
MAX-ACCESS read-write
STATUS current
DESCRIPTION
"If the tftp path of a command batch file is set, the present configurations
will changed depending on the execution of the command in the batch file."
::= { switchConfigGroup 1 }
picaConformance OBJECT IDENTIFIER ::= { picaPrivateMib 20}
picaGroups OBJECT IDENTIFIER ::= { picaConformance 1 }
picaCompliances OBJECT IDENTIFIER ::= { picaConformance 2 }
picaBasicGroup OBJECT-GROUP
OBJECTS {
cpuUsage,
totalPhyMemory,
usedPhyMemory,
freePhyMemory,
switchTemperature,
cpuTemperature,
switchChipTemperature,
switchFanSpeed,
switchPWM
}
STATUS current
DESCRIPTION
"These objects are required for pica private mib."
::= { picaGroups 1 }
picasfpGroup OBJECT-GROUP
OBJECTS {
sfpIndex,
sfpVendorName,
sfpSerialNumber,
sfpTemp,
sfpVoltage,
sfpBias,
sfpTxPower,
sfpRxPower,
sfpType
}
STATUS current
DESCRIPTION
"These objects are required for pica private mib."
::= { picaGroups 2 }
picarpsuGroup OBJECT-GROUP
OBJECTS {
rpsuIndex,
serialNumber,
rpsuStatus,
rpsuTemprature,
rpsuFanSpeed,
rpsuPWM
}
STATUS current
DESCRIPTION
" These objects are required for pica private mib."
::= { picaGroups 3 }
picaConfigGroup OBJECT-GROUP
OBJECTS {
tftpConfigFilePath,
tftpBatchFilePath
}
STATUS current
DESCRIPTION
" These objects are required for pica private mib."
::= {picaGroups 4 }
picaCompliance MODULE-COMPLIANCE
STATUS current
DESCRIPTION
"The compliance statement "
MODULE -- this module
MANDATORY-GROUPS {
picaBasicGroup,
picasfpGroup,
picarpsuGroup,
picaConfigGroup
}
::= { picaCompliances 1 }
END

15254
tests/data/picos.json Normal file

File diff suppressed because it is too large Load Diff

2561
tests/snmpsim/picos.snmprec Normal file

File diff suppressed because it is too large Load Diff