Files
Tony MurrayandNeil Lathwood eeb3d58f5b Improved Logging and Debugging (#8870)
Use Log facility when Laravel is booted.
Update init.php so we can easily boot Laravel for CLI scripts. (and just Eloquent, but that may go away)
Move all debug setup into set_debug() function and use that across all scripts.
Log Laravel database queries.
Send debug output to librenms log file when enabling debug in the webui.
Allow for colorized Log CLI output. (currently will leave % tags in log file output)

** Needs testing and perhaps tweaking still.

DO NOT DELETE THIS TEXT

#### Please note

> Please read this information carefully. You can run `./scripts/pre-commit.php` to check your code before submitting.

- [x] Have you followed our [code guidelines?](http://docs.librenms.org/Developing/Code-Guidelines/)

#### Testers

If you would like to test this pull request then please run: `./scripts/github-apply <pr_id>`, i.e `./scripts/github-apply 5926`
2018-07-13 23:08:00 +01:00

65 lines
2.5 KiB
PHP

<?php
/**
* boss.inc.php
*
* LibreNMS Fan and Power Supply state Discovery module for Extreme/Avaya ERS
*/
if ($device['os'] === 'boss') {
$oid = snmpwalk_cache_oid($device, 's5ChasComTable', array(), 'S5-CHASSIS-MIB');
$cur_oid = '.1.3.6.1.4.1.45.1.6.3.3.1.1.10.';
if (is_array($oid)) {
//get states
$state_name = 's5ChasComOperState';
$state_index_id = create_state_index($state_name);
//Create State Translation
if ($state_index_id) {
$states = array(
array($state_index_id,'other' ,0,1,3) ,
array($state_index_id,'notAvail' ,0,2,3) ,
array($state_index_id,'removed' ,0,3,3) ,
array($state_index_id,'disabled' ,0,4,3) ,
array($state_index_id,'normal' ,0,5,0) ,
array($state_index_id,'resetInProg',0,6,1) ,
array($state_index_id,'testing' ,0,7,1) ,
array($state_index_id,'warning' ,0,8,1) ,
array($state_index_id,'nonFatalErr',0,9,1) ,
array($state_index_id,'fatalErr' ,0,10,2) ,
array($state_index_id,'notConfig' ,0,11,3) ,
array($state_index_id,'obsoleted' ,0,12,3)
);
}
foreach ($states as $value) {
$insert = array(
'state_index_id' => $value[0],
'state_descr' => $value[1],
'state_draw_graph' => $value[2],
'state_value' => $value[3],
'state_generic_value' => $value[4]
);
dbInsert($insert, 'state_translations');
}
// get fans (6) and temp (5) sensor only from walk
$ers_sensors = array();
foreach ($oid as $key => $value) {
if ($key['s5ChasComGrpIndx'] == 5 || $key['s5ChasComGrpIndx'] == 6) {
$ers_sensors[$key] = $value;
}
}
foreach ($ers_sensors as $index => $entry) {
//Get unit number
$unit_array = explode(".", $index);
$unit = floor($unit_array[1]/10);
$descr = "Unit $unit: $entry[s5ChasComDescr]";
//Discover Sensors
discover_sensor($valid['sensor'], 'state', $device, $cur_oid.$index, "s5ChasComOperState.$index", $state_name, $descr, '1', '1', null, null, null, null, $entry['s5ChasComOperState']);
//Create Sensor To State Index
create_sensor_to_state_index($device, $state_name, "s5ChasComOperState.$index");
}
}
}