Skip to content

Commit

Permalink
catching up my fork to latest master (#1)
Browse files Browse the repository at this point in the history
* WebUI - Spanning Tree Link in Eventlog (librenms#12571)

* Fix bullet points (librenms#12574)

The bullet points appear incorrectly on the page still, in two different places. Hopefully this will fix it

* Switch to utf8mb4 (librenms#12501)

* Switch to utf8mb4

This allows emojis to function correctly

* Update URLs

* DynamicDiscovery - Guess num_oid if not provided in YAML file (librenms#12570)

* Guess num_oid if not provided in YAML file
* Discover Processor num_oid if necessary
* num_oid is now optional

* documentation upgrade

* Revert "Switch to utf8mb4 (librenms#12501)" (librenms#12578)

This reverts commit 8e2e67d.

* Cisco enhanced cellular (librenms#12463)

* Cisco enhanced cellular support

* Extra sensors, camelcasing and bugfixes

* Doc update

* German translation

* French translation

* Style fixes

* Style changes

* Style changes

* Style changes

* Style changes

* Style changes

* Added test data

* New test data --variant

* New test data --variant ir1101

* Made the new wireless sensors generic

* Added test data for ios variant ir809

* Fix includes/discovery/sensors/count/cisco.inc.php, thanks PipoCanaja

* Moved cellular operating band from Wireless sensors to count sensor

* test data

* test data

* test data

* test data

* Moved ICCID/IMSI/IMEI to inventory

* test data and style fix

* Cellular state sensors now have a group

Co-authored-by: Maikel de Boer <mdb@tampnet.com>

* Developer device simulation (librenms#12577)

* Developer device simulation
lnms dev:simulate
handy helper to start snmpsim with test data and optionally add and remove a device to LibreNMS

* doc update

* remove legacy json format function (librenms#12583)

* remove legacy json format function

* remove silly use

* Add minimum database version check (librenms#12581)

* Location tests more reliable (librenms#12584)

* Location tests more reliable

* perhaps this stayed disabled

* Global Settings - SNMP Timeout (librenms#12579)

* Global Settings - SNMP Timeout

* omit snmp timeout if it is 1

* add retries field

* filter default retries too

* fix typo

Co-authored-by: Tony Murray <murraytony@gmail.com>

* Collect BIOS version for IBMC (librenms#12586)

* Add Google Chat Transport (librenms#12558)

* Add Google Chat Transport

* Bug. False response on succesfully sended messages

* Style CI patch

* webui: Add button to show verbose alert details in the alert, alert-log webui (librenms#12484)

* Show verbose alert details in the alert, alert-log webui

update file permissions

* Make global admin permission required to use alert details ui

* StyleCI patch

Co-authored-by: root <root@usopsl-libre001.corp.blizzard.net>

* support newer SyncServer (librenms#12423)

* update microsemitime.yaml to support newer SyncServer sysObjectId, add additional device information fields and sensors

* fix test data. I keep forgetting that.

* Added alarm detection and optical PMs for Waveserver Ai (librenms#12380)

* Fix broken tests (librenms#12588)

* Use high precision OIDs for APC UPS sensors (librenms#12158)

* docker stats app (librenms#12358)

* docker stat app support

* Add missing doc and app

* stylci

* styleci

* styleci

* Add test data

* add snmpsim

* Update docker.inc.php

test with use Number::Bi

* typo

* Add tests

* Add tests

Co-authored-by: Jellyfrog <Jellyfrog@users.noreply.github.com>

* Add application powermon (librenms#12500)

* adding powermon application

* working consumption graph

* updating powermon application

* powermon app style fixes

* added powermon app test data

* debug code

* revert

* fix tests

* fix tests

Co-authored-by: Tony Murray <murraytony@gmail.com>
Co-authored-by: Jellyfrog <Jellyfrog@users.noreply.github.com>

* Revert "Use high precision OIDs for APC UPS sensors (librenms#12158)" (librenms#12592)

This reverts commit b340a3e.

* Oxidized support airfiber (librenms#12597)

map airos-af and airos-af-ltu to the correct model

* Fix dev:simulate (librenms#12596)

* Fix AOS 7 sensors (librenms#12599)

* AOS7 WIP

* Fix AOS 7 sensors

* TX Bias -> TX Power

* Fixes

* Bump elliptic from 6.5.3 to 6.5.4 (librenms#12602)

Bumps [elliptic](https://github.com/indutny/elliptic) from 6.5.3 to 6.5.4.
- [Release notes](https://github.com/indutny/elliptic/releases)
- [Commits](indutny/elliptic@v6.5.3...v6.5.4)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Update Agent-Setup.md (librenms#12601)

For Linux systemd, add a description on how to restrict the agent to only listen on one interface (instead of all)

* doc: broken link on fast-polling page (librenms#12595)

* Set correct min database version (librenms#12606)

https://laravel.com/docs/8.x/migrations#index-lengths-mysql-mariadb

* Service templates -  fix rules (librenms#12587)

* Service Templates - Submit Error

* Service Templates - Rules Error

* Service Templates - Rules Error

* Service Templates - Rules Error

* Service Templates - Rules Error

* add css text center (librenms#12608)

* Psuedowire test data guess (librenms#12604)

* Sort Type List in Eventlog Pages (librenms#12572)

* Sort Type List in Eventlog Pages

* update code

* hpe-ilo - Added support for Logical Drive Status (librenms#12612)

* Update hpe-ilo.yaml

Added support for Logical Drive Status.

When using 3rd party disks with for example P420i, the controller reports the Logical Drive Condition as degraded as the disk is unauthenticated. So to get the actual status of the logical device one has to look at Logical Drive Status instead (which also reports a lot of other states).

* Update hpe-ilo_4.json

* Update hpe-ilo.yaml

* Update hpe-ilo_4.json

Typo

* Adding Cisco ME1200 support (librenms#12527)

* Create ciscome.yaml

Adding initial discovery. Needs tweaking.

* Update ciscome.yaml

* Update ciscome.yaml

Updated

* Add snmprec data

* Update ciscome.yaml

Updating "text" field for clarification so it would be better differentiated between other Cisco OSes. 
Removed "cisco-cbqos" as it is not supported.

* Update ciscome.snmprec

Fixed line 14 as it should have been one long line

* Add ciscome_me1200.json test data

Test data for Cisco ME1200

* Rename ciscome_me1200.json to ciscome.json

* Update ciscome.json

fixed interface names to match snmprec file

* Delete ciscome.json

* Adding ciscome.json once more to fix descrptions

for some interfaces to match snmprec file

* Update ciscome.json

* Update ciscome.json

* Update ciscome.snmprec

* Update ciscome.json

* Update and rename ciscome.yaml to ciscome1200.yaml

* Update and rename ciscome.json to ciscome1200.json

* Rename ciscome.snmprec to ciscome1200.snmprec

* PHP 8 fixes (librenms#12528)

* port related errors

* more fixes

* fix storage count

* add tests for php8

* style

* only need not empty

* aix fixes....

* storage WIP

* fix aix discovering hrstorage
fix db test adding .gitkeep
fix os modules when discovery only

* fix aos processors wrong oid

* fix mempool number casting

* fix aos7 cpu

* use + 0 cast instead of floatval()

* more verbose error on invalid json

* remove invalid data in json

* actually fix the json

* correct json error fix

* cast_number() function
fix aruba-instant and aos6 bugs exposed by new function, probably more...

* fix a-f
fix inadequate sort for component data

* fix global port poll time

* fix mempools precent 0, route count, ntp const

* fix schleifenbauer liberal current usage

* further number casting refinement

* vrp

* fix tests

* fix arbos

* warn cleanups adjust to :: change

* fix ciena-sds

* fix drac

* fix dell-rpdu anddlink

* fix and improve arubaos
better error when getting an array in Processor

* fix atenpdu, add missing arubaos files

* aruba-instant to yaml
apparently I didn't need to do this, the diff just looks really odd
It did add ranged sub-index replacements

* docker app, was completely wrong... fixed

* fix sentry4 divide by 0...

* fixed root issue, remove check

* nicer cidr in ipv6 code

* remove bogus enuxus battery bank skip_values

* Fix InfluxDB tests

* remove extra import

* fix other style issues.

* influx "style" fixes

* Add identification for Edgeswitch 8XP (librenms#12622)

* Update edgeswitch.yaml

add frogfoot enterprise for old edgeswitch devices

* Create edgeswitch_edgeswitch-8xp.snmprec

* Create edgeswitch_edgeswitch-8xp.json

* Rename edgeswitch_edgeswitch-8xp.json to edgeswitch_8xp.json

* Rename edgeswitch_edgeswitch-8xp.snmprec to edgeswitch_8xp.snmprec

Co-authored-by: PipoCanaja <38363551+PipoCanaja@users.noreply.github.com>

* Fix Service Templates Dynamic (librenms#12626)

* Fix Service Templates Dynamic
Remove dynamic groups type, it did not work.
Rename and simplify field names.  (fixing an issue with the builder where the rules field should be named rules)

* update schema def

* wrong method name in migration

* fix rules builder

* corerct call to apply

* sqlite can't drop columns

* correct column rename order on down.

* fix sqlite again

* fix whitespace

* Chrony support (librenms#12488)

* initial chrony implementation

* remove unused import

* add testing data

* fix test data

* fix tests

Co-authored-by: Jellyfrog <Jellyfrog@users.noreply.github.com>

* Update availability-map.inc.php (librenms#12632)

fix services url in availability maps as currently generates a 404

* Fix status badge url (librenms#12631)

* Simplify process reaping (librenms#12593)

Fixes librenms#12427

* Add more printer data (librenms#12617)

* Fix serverchecks tests (librenms#12635)

* Fix serverchecks tests (librenms#12636)

* Bugfix for no sockets on Unix Agents (librenms#12637)

* Bugfix for no sockets on Unix Agents

Fix Bug: Argument #1 ($stream) must be of type resource, bool given...

* Update unix-agent.inc.php

Fix Style

* Changelog for 21.3.0

* Bump version to 21.3.0

* PHP8 Bug in printChangedStats (librenms#12639)

array_sum(): Argument #1 ($array) must be of type array, null given

* service watchdog - add systemd watchdog for resiliency (librenms#12188)

* Add systemd watchdog service

* Add systemd watchdog service

* Add systemd watchdog service - add try

* Add systemd watchdog service - add try

* Add systemd watchdog service - add try

* Add systemd watchdog service - add try

* Add systemd watchdog service - add try

* Add systemd watchdog service - update docs for python3-systemd

* systemd-watchdog - move to 10 second alert frequency

* systemd-watchdog - move to 10 second alert frequency

* systemd-watchdog - move to 30 second restart, 10 second delay between restarts

* systemd-watchdog - safely integrate changes

* systemd-watchdog - safely integrate changes

* systemd-watchdog - revert old doc changes

* systemd-watchdog -  doc typo fix

* Translate hex sensor values returned from ipmitool (librenms#12638)

* Translate hex sensor values returned from ipmitool

* Style fix

* Fix rewrite - use matches array

* add UKFast PSS transport (librenms#12624)

* add UKFast PSS transport

* rename var

* use correct class signature

* fix styleci

* styleci

* styleci

* Correct sensor_id variable (librenms#12633)

Co-authored-by: SourceDoctor <sourcehhdoctor@googlemail.com>
Co-authored-by: Matt Calvert <miff2000@users.noreply.github.com>
Co-authored-by: Jellyfrog <Jellyfrog@users.noreply.github.com>
Co-authored-by: PipoCanaja <38363551+PipoCanaja@users.noreply.github.com>
Co-authored-by: Tony Murray <murraytony@gmail.com>
Co-authored-by: Janno Schouwenburg <mail@janno.nl>
Co-authored-by: Maikel de Boer <mdb@tampnet.com>
Co-authored-by: pbaldovi <pbaldovi@gmail.com>
Co-authored-by: theochita <ochita@fastmail.com>
Co-authored-by: root <root@usopsl-libre001.corp.blizzard.net>
Co-authored-by: Andrew Holmes <4232981+neg2led@users.noreply.github.com>
Co-authored-by: Dan Baker <16193241+bakerds@users.noreply.github.com>
Co-authored-by: Cirno the Strongest <1447794+CirnoT@users.noreply.github.com>
Co-authored-by: Lucas Dousse <Cormoran96@users.noreply.github.com>
Co-authored-by: yrebrac <yrebrac@upaya.net.au>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Chewie <Chewie9999@hotmail.com>
Co-authored-by: Bennet Gallein <48118908+bennet-esyoil@users.noreply.github.com>
Co-authored-by: Anthony F. McInerney <anthony@outworlds.de>
Co-authored-by: rasssta <rasssta@rasssta.info>
Co-authored-by: aarchijs <lillais@inbox.lv>
Co-authored-by: Simon Smith <simonsmith5521@gmail.com>
Co-authored-by: Serphentas <Serphentas@users.noreply.github.com>
Co-authored-by: Richard Kojedzinszky <rkojedzinszky@users.noreply.github.com>
Co-authored-by: Kevin Zink <mpikzink@users.noreply.github.com>
Co-authored-by: Matthew Simmons <simmonmt@google.com>
Co-authored-by: Lee Spottiswood <me@lee.io>
  • Loading branch information
1 parent be5a322 commit a1fc501
Show file tree
Hide file tree
Showing 290 changed files with 46,634 additions and 8,056 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/test.yml
Expand Up @@ -26,16 +26,22 @@ jobs:
matrix:
include:
-
php-version: 7.4
php-version: 8.0
name: Unit
skip-style-check: 1
skip-web-check: 1
database: mariadb:10.5
-
php-version: 7.4
php-version: 8.0
name: Style and Web
skip-unit-check: 1
database: mysql:5.7
-
php-version: 7.4
name: Unit
skip-style-check: 1
skip-web-check: 1
database: mysql:5.7
-
php-version: 7.3
name: Unit
Expand Down
91 changes: 91 additions & 0 deletions LibreNMS/Alert/Transport/Googlechat.php
@@ -0,0 +1,91 @@
<?php
/**
* LibreNMS Google Chat alerting transport
*
* 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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @link http://librenms.org
* @copyright 2021 Pablo Baldovi
* @author Pablo Baldovi <pbaldovi@gmail.com>
*/

namespace LibreNMS\Alert\Transport;

use LibreNMS\Alert\Transport;
use Log;

class Googlechat extends Transport
{
public function deliverAlert($obj, $opts)
{
$googlechat_conf['webhookurl'] = $this->config['googlechat-webhook'];

return $this->contactGooglechat($obj, $googlechat_conf);
}

public static function contactGooglechat($obj, $data)
{
$payload = '{"text": "' . $obj['msg'] . '"}';

Log::debug($payload);

// Create a new cURL resource
$ch = curl_init($data['webhookurl']);

// Attach encoded JSON string to the POST fields
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);

// Set the content type to application/json
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type:application/json']);

// Return response instead of outputting
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

// Execute the POST request
$result = curl_exec($ch);

// Close cURL resource

$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

Log::debug($code);

if ($code != 200) {
Log::error('Google Chat Transport Error');
Log::error($result);

return 'HTTP Status code ' . $code;
}

return true;
}

public static function configTemplate()
{
return [
'config' => [
[
'title' => 'Webhook URL',
'name' => 'googlechat-webhook',
'descr' => 'Google Chat Room Webhook',
'type' => 'text',
],
],
'validation' => [
'googlechat-webhook' => 'required|string',
],
];
}
}
115 changes: 115 additions & 0 deletions LibreNMS/Alert/Transport/Ukfastpss.php
@@ -0,0 +1,115 @@
<?php
/* Copyright (C) 2020 Raphael Dannecker <rdannecker@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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>. */

/**
* UKFastPSS Transport
* @author Lee Spottiswood (github.com/0x4c6565)
* @copyright 2021, LibreNMS
* @license GPL
*/

namespace LibreNMS\Alert\Transport;

use LibreNMS\Alert\Transport;

class Ukfastpss extends Transport
{
public function deliverAlert($obj, $opts)
{
return $this->contactUkfastpss($obj, $opts);
}

public function contactUkfastpss($obj, $opts)
{
$apiKey = $this->config['api-key'];
$author = $this->config['author'];
$secure = $this->config['secure'];
$priority = $this->config['priority'];

$body = [
'author' => [
'id' => $author,
],
'secure' => ($secure == 'on'),
'subject' => $obj['title'],
'details' => $obj['msg'],
'priority' => $priority,
];

$request_opts = [];
$request_headers = [];

$request_headers['Authorization'] = $apiKey;
$request_headers['Content-Type'] = 'application/json';
$request_headers['Accept'] = 'application/json';

$client = new \GuzzleHttp\Client();
$request_opts['proxy'] = get_guzzle_proxy();
$request_opts['headers'] = $request_headers;
$request_opts['body'] = json_encode($body);

$res = $client->request('POST', 'https://api.ukfast.io/pss/v1/requests', $request_opts);

$code = $res->getStatusCode();
if ($code != 200) {
return 'HTTP Status code ' . $code;
}

return true;
}

public static function configTemplate()
{
return [
'config' => [
[
'title' => 'API Key',
'name' => 'api-key',
'descr' => 'API key to use for authentication',
'type' => 'text',
],
[
'title' => 'Author',
'name' => 'author',
'descr' => 'Author ID for new PSS request',
'type' => 'text',
],
[
'title' => 'Priority',
'name' => 'priority',
'descr' => 'Priority of request. Defaults to "Normal"',
'type' => 'select',
'options' => [
'Normal' => 'Normal',
'High' => 'High',
'Critical' => 'Critical',
],
'default' => 'Normal',
],
[
'title' => 'Secure',
'name' => 'secure',
'descr' => 'Specifies whether created request should be secure',
'type' => 'checkbox',
'default' => true,
],
],
'validation' => [
'api-key' => 'required',
'author' => 'required',
],
];
}
}
12 changes: 2 additions & 10 deletions LibreNMS/Data/Store/InfluxDB.php
Expand Up @@ -121,7 +121,7 @@ public function put($device, $measurement, $tags, $fields)

$this->connection->writePoints($points);
$this->recordStatistic($stat->end());
} catch (\Exception $e) {
} catch (\InfluxDB\Exception $e) {
Log::error('InfluxDB exception: ' . $e->getMessage());
Log::debug($e->getTraceAsString());
}
Expand Down Expand Up @@ -159,18 +159,10 @@ private function forceType($data)
* therefore may cause breakages on inserts.
* Just setting every number to a float gets around this, but may introduce
* inefficiencies.
* I've left the detection statement in there for a possible change in future,
* but currently everything just gets set to a float.
*/

if (is_numeric($data)) {
// If it is an Integer
if (ctype_digit($data)) {
return floatval($data);
// Else it is a float
} else {
return floatval($data);
}
return floatval($data);
}

return $data === 'U' ? null : $data;
Expand Down
2 changes: 1 addition & 1 deletion LibreNMS/Device/Sensor.php
Expand Up @@ -364,7 +364,7 @@ private static function fetchSnmpData($device, $sensors)
array_walk($snmp_data, function (&$oid) {
preg_match('/-?\d+(\.\d+)?(e-?\d+)?/i', $oid, $matches);
if (isset($matches[0])) {
$oid = $matches[0] + 0;
$oid = cast_number($matches[0]);
} else {
$oid = trim('"', $oid); // allow string only values
}
Expand Down
6 changes: 6 additions & 0 deletions LibreNMS/Device/WirelessSensor.php
Expand Up @@ -200,6 +200,12 @@ public static function getTypes($valid = false, $device_id = null)
'distance' => [
'icon' => 'space-shuttle',
],
'cell' => [
'icon' => 'line-chart',
],
'channel' => [
'icon' => 'line-chart',
],
];

if ($valid) {
Expand Down

0 comments on commit a1fc501

Please sign in to comment.