Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add OS detection and temperature sensor support for Asentria SiteBoss #7655

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Binary file added html/images/os/siteboss.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions includes/definitions/siteboss.yaml
@@ -0,0 +1,12 @@
os: siteboss
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the OS /firmware name or does it not have one and so the product name is used?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The latter. Did not have one (that I could find) and so the product name was used.

text: 'Asentria SiteBoss'
type: server
icon: siteboss
over:
- { graph: device_bits, text: 'Device Traffic' }
- { graph: device_processor, text: 'CPU Usage' }
- { graph: device_mempool, text: 'Memory Usage' }
mib_dir: asentria
discovery:
- sysObjectId:
- .1.3.6.1.4.1.3052.12
32 changes: 32 additions & 0 deletions includes/discovery/sensors/temperature/siteboss.inc.php
@@ -0,0 +1,32 @@
<?php

/*
* LibreNMS Temperature Sensor Discovery module for Asentria SiteBoss
*
* © 2017 Chris A. Evans <thecityofguanyu@outlook.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.
*/

echo 'Asentria SiteBoss ';

$tempoids = snmp_walk($device, 'esIndexPC', '-Osqn', 'SITEBOSS-530-STD-MIB');
Copy link
Member

@laf laf Nov 7, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this not be converted to yaml?

If not, you should at least use one of the snmp walk cache functions so you don't need to split on new lines and things.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked at the YAML sensor docs and certainly considered it, but wasn't as confident in my ability to make it work as I was with the PHP files.

$tempoids = trim($tempoids);

foreach (explode("\n", $tempoids) as $data) {
$data = trim($data);
$data = explode(" ", $data);
if ($data[1] == '1') {
$oid = str_replace('.1.3.6.1.4.1.3052.12.1.1.1.1.2.', '', $data[0]);
$temperature_oid = ".1.3.6.1.4.1.3052.12.1.1.1.1.6.$oid";
$descr_oid = ".1.3.6.1.4.1.3052.12.1.1.1.1.4.$oid";
$descr = snmp_get($device, $descr_oid, '-Oqv', '');
$temperature = str_replace('"', '', snmp_get($device, $temperature_oid, '-Oqv', ''));

discover_sensor($valid['sensor'], 'temperature', $device, $temperature_oid, $oid, 'siteboss', $descr, '1', '1', null, null, null, null, fahrenheit_to_celsius($temperature));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be:

discover_sensor($valid['sensor'], 'temperature', $device, $temperature_oid, $oid, 'siteboss', $descr, '1', '1', null, null, null, null, 'fahrenheit_to_celsius');

}
}
23 changes: 23 additions & 0 deletions includes/polling/os/siteboss.inc.php
@@ -0,0 +1,23 @@
<?php

/*
* LibreNMS OS Polling module for Asentria
*
* © 2017 Chris A. Evans <thecityofguanyu@outlook.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.
*/

$asentsysdescr = $poll_device['sysDescr'];
$version = preg_replace('/^\s*(\S+\s+\S+\s+)/', '', $asentsysdescr);
$hardware = preg_match('/^\S+\s+\d+\s+/', $asentsysdescr, $matches);
$hardware = trim($matches[0]);

unset(
$asentsysdescr,
$matches
);
15 changes: 15 additions & 0 deletions includes/polling/sensors/temperature/siteboss.inc.php
@@ -0,0 +1,15 @@
<?php

/*
* LibreNMS Temperature Sensor polling module for Asentria SiteBoss
*
* © 2017 Chris A. Evans <thecityofguanyu@outlook.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.
*/

$sensor_value = fahrenheit_to_celsius($sensor_value);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the register of the callback this file shouldn't be needed.

25 changes: 25 additions & 0 deletions mibs/asentria/ASENTRIA-ROOT-MIB
@@ -0,0 +1,25 @@
ASENTRIA-ROOT-MIB DEFINITIONS ::= BEGIN

IMPORTS
MODULE-IDENTITY,
enterprises
FROM SNMPv2-SMI;

asentria MODULE-IDENTITY
LAST-UPDATED "201003090000Z"
ORGANIZATION "Asentria Corporation"
CONTACT-INFO
"Phone: 206-344-8800
Fax: 206-344-2116
Email: support@asentria.com"
DESCRIPTION
"Asentria root MIB module"
REVISION "201003090000Z"
DESCRIPTION
"Updated CONTACT-INFO comment."
REVISION "200709090000Z"
DESCRIPTION
"Asentria root MIB module"
::= { enterprises 3052 }
--1.3.6.1.4.1.3052
END