Commit Graph

184 Commits

Author SHA1 Message Date
mzacchi
71cd81269a Update Api.php to include Options variable in the Body for POST requests (#13167)
* Update Api.php
* Update Api.php
Correct syntax for variable replacement : '{{ $' . $metric . ' }}'
* style
Co-authored-by: PipoCanaja <38363551+PipoCanaja@users.noreply.github.com>
2021-08-28 23:19:06 +02:00
Tony Murray
d8d0ccd03d Common contexts for polling (#13158)
* Common contexts for polling
Don't store contexts on the device array, use the device model
Also should be easier to add different contexts later.

* rename variables for consistency
2021-08-23 01:22:28 -05:00
ottorei
bc56f94f8f PagerDuty transport: Add EU service region (#13154) 2021-08-20 10:04:51 +02:00
geg347
a4a04e6f09 Adding html_entity_decode function to fix HTML encoded characters in Slack Transport Alert (#13120) 2021-08-09 18:34:43 -05:00
Tony Murray
2b8eb74b7a Detect sending non-html emails as html (#13114)
* Detect sending non-html emails as html
and use <br /> for line returns instead of \r\n

* Fix style
2021-08-09 09:17:32 -05:00
igorek24
2f267ca739 Add SignalWire (Twilio alternative) alert transport support (#13107)
* Add SignalWire (Twilio alternative) alert transport support

* Add SignalWire (Twilio alternative) alert transport support
2021-08-05 10:26:29 +02:00
Kevin Zink
d0d8a9024b Add Signal CLI transport support (#12954)
* Add Signal CLI support

* Update Signal.php

* fix style

* fix style

* fix CI style

* fix CI style

* escapeshellarg

* fix style

* fix style

* fix style
2021-06-18 00:38:09 +02:00
Sean
bcedc0ed77 Improve Markdown syntax in Document (#12949)
* Use GitLab instead of Gitlab

Only change text part, the Alert.Transport.Gitlab class left as is.

* Fix href in document

* Move section in document

The agent list in this document is sorted by alphabetical order,
"SDFS info" is the only exception.

* Remove trailing spaces in document

* Align code in document

* Fix Markdown in document

- Escape underline
- Add syntax highlight
- Add two space in the end of line to make it a newline
- Add newline before list or code section

* Update LibreNMS/Alert/Transport/Gitlab.php

Co-authored-by: Jellyfrog <Jellyfrog@users.noreply.github.com>
2021-06-16 21:16:21 +02:00
Jellyfrog
3e3aa9077e Revert "Fix StringBlade errors with a stub file" (#12776)
This reverts parts of commit 165c4fd53c.
2021-04-21 23:22:15 +02:00
Jellyfrog
165c4fd53c Enable PHPStan linter (#12678)
* Enable PHPStan linter

* Add PHPStan baseline

* Switch to Level 5

* Fix StringBlade errors with a stub file
2021-04-21 07:41:34 -05:00
PipoCanaja
6a3b1c94ea Missing in select (#12771) 2021-04-20 23:24:16 +02:00
Jellyfrog
a8c8a9a4a2 Misc cleanup (#12758)
* Fix Docblock

* Misc

* Parameter #2 $callback of function array_filter expects (callable(mixed, mixed): bool)|null, 'strlen' given

* Parameter #2 $data of function hash_hmac expects string, int given

* Unreachable statement - code above always terminates.

* Update Device.php
2021-04-20 12:47:22 +02:00
Jellyfrog
edb36fd69d More cleanups (#12715)
* PHPDoc

* Replace Auth > Illuminate\Support\Facades\Auth

* Return inside when()

* use str_replace correct

* Misc

* dead code

* use int $port

* styleci
2021-04-08 08:14:49 -05:00
Jellyfrog
6616727a95 Fix alert template variable ping_timestamp (#12690)
* Fix RunAlerts typo

* Update Template.php

* Update QueryBuilderFluentParser.php

* Update QueryBuilderParser.php
2021-03-31 18:06:07 -05:00
Jellyfrog
58af994c6b Linting (#12677)
* Fix Canopsis Transport

* Lint Hipchat

* Lint IRCBot.php

* Misc

* Update Hipchat.php

* Update Notification.php
2021-03-31 17:29:22 +02:00
Jellyfrog
6c59f368b0 Linting: Fix misc problems (#12675) 2021-03-29 17:43:05 -05:00
Tony Murray
1c379dcd05 Remove legacy function calls (#12651)
* massive inlines

* fix style and wtf

* remove rrdtool.inc.php include

* fix CommonFunctions namespace issues

* looking for missing class space, fix undefined class issues

* style fixes
2021-03-29 00:25:30 +02:00
Jellyfrog
efb157f5fb Fix more PHPDoc (#12665)
* Fix PHPDoc

* Fix PHPDoc
2021-03-28 12:18:47 -05:00
Filippo Giunchedi
c8c8bc3a81 Support multiple Alertmanager URLs (#12346) 2021-03-27 10:01:48 -05:00
Jellyfrog
3cfffb9912 Cleanups (#12642)
Should only be cosmetic
2021-03-24 09:13:43 -05:00
Jellyfrog
58a154d894 Fix a bunch of bugs (#12643) 2021-03-23 23:08:42 +01:00
Lee Spottiswood
283dafda1c add UKFast PSS transport (#12624)
* add UKFast PSS transport

* rename var

* use correct class signature

* fix styleci

* styleci

* styleci
2021-03-22 10:39:58 -05:00
pbaldovi
9f208360b3 Add Google Chat Transport (#12558)
* Add Google Chat Transport

* Bug. False response on succesfully sended messages

* Style CI patch
2021-03-06 21:48:20 +01:00
Jellyfrog
20b4215204 Swich links to https (#12511)
* Switch librenms links to https

* Convert librenms links in comments

* Switch gnu.org url to https

* switch php urls to https
2021-02-09 00:29:04 +01:00
abrezinsky
240edd2143 Use a proxy server for the PagerDuty transport. (#12294)
* Use a proxy server for the PagerDuty transport.

We don't use the get_guzzle_proxy() function since tcp:// doesn't work
with all of the HTTP transports that Guzzle supports.  Instead we use
the standard get_proxy() function.

Tested against Squid

* formatting only
2020-11-04 15:03:48 +01:00
Yuwei Ba
fd2c1361ef Update Telegram.php (#12228)
Return Telegram response body when failed so users will know where went wrong, bad template etc.
2020-10-19 09:27:01 -05:00
Jellyfrog
29f45ca352 Apply fixes from StyleCI (#12124) 2020-09-21 15:59:34 +02:00
Jellyfrog
0d56bbd946 Apply fixes from StyleCI (#12123) 2020-09-21 15:51:53 +02:00
Jellyfrog
77c531527c Apply fixes from StyleCI (#12117)
* Apply fixes from StyleCI

* Disable style check
2020-09-21 14:54:51 +02:00
thomcatdotrocks
dfab530525 Matrix txnid fix (#12057)
* Fix Matrix alerting txnid

This fixes the issue I brought up in #12018.  I can confirm that I now get a new message from the LibreNMS bot every time I test my Matrix transport.

* Update AUTHORS.md
2020-09-04 16:38:19 +02:00
Raphael Dannecker
73b7636c9f Matrix alert transport (#12018)
* Added Matrix as alert-channel (Feature request #4927)

* formatting

* Dokumentation of matrix-transport

* Matrix Server-URL

* Formatting
2020-08-20 12:04:17 +02:00
kleinem86
a4f5af069c Added Proxy support for Api Transport (#11968) 2020-07-29 16:00:55 +02:00
Tony Murray
76a7ea1a63 Fix alert last modified timestamps
mysql timestamp columns do not accept timestamps
2020-06-15 22:24:14 -05:00
Tony Murray
0a5c3cc747 Fix Device::isUnderMaintenance() add location relation 2020-06-14 12:39:10 -05:00
Tony Murray
13ade9ab6c Merge branch 'master' into alerts-carbon 2020-06-12 07:48:51 -05:00
SourceDoctor
125ecb4bde Eventlog Application Alert in it's Severity Colour (#11660)
* Eventlog Application Alert in it's Severity Colour

* use 'use'

* enums

* enum key list

* typo fix
2020-06-08 10:56:45 +02:00
pepperoni-pi
28ae37c406 Added ability to use JSON directly in Msteams Transport (#11129)
* Added ability to use JSON directly in Msteams Transport

* Update Transports.md

* Update Msteams.php

* Update Msteams.php

Added boolean to fix test transport button

* Update Templates.md

Added JSON example and modified titles slightly.

* Update Templates.md

Moved MS Teams examples under "Examples" header since they are no longer formatted in HTML

* Update Templates.md

* Update Templates.md

* Update Msteams.php

changed condition to use $obj['id'] rather than $obj['msg']

* Update Msteams.php
2020-06-04 22:18:49 -05:00
nepeat
736a6a419c Make the Discord transport more formatted for Discord. (#11461)
* Make the Discord transport more formatted for Discord.

* Generate the fields using a function for cleaner code.

* Handle cases where the elapsed time does not exist in the object.
2020-06-01 02:04:12 +02:00
SourceDoctor
b89eb22cd5 Enumerate AlertState (#11665)
* Enumerate AlertState

* fix typo

* add missing use's

* .

* .
2020-05-23 21:14:36 -05:00
VTS
60552d96ae Copy and modify the syslog transport for sending alerts to Splunk in an easy to parse format (#11176)
* Create Splunk.php

* add documentation

add documentation for splunk transport rule

Co-authored-by: Tony Murray <murraytony@gmail.com>
2020-05-11 23:11:45 -05:00
spencerryan
39ef4dc503 Do not delay alert recovery notifications (#11555)
Skip the delay logic for recovery.
2020-05-06 23:02:43 +02:00
spencerryan
9b22bcc5b8 Send Device group membership to Pagerduty (#11522)
* Send Device group membership to Pagerduty

Send device group membership to pagerduty. This allows routing (event rules) on the Pagerduty side to make decisions based on group membership inside LibreNMS

* Simplified changes

Rolled all changes into one line per @murrant sugguestions
2020-05-03 13:22:48 +02:00
spencerryan
a545c87ad5 Allow manual configuration of Pagerduty Integration Key (#11519)
* Allow manual configuration of Pagerduty Integration Key

Pagerduty supports a global event queue per account and provides the integration key for it. This allows you to enter the key directly and bypass the OAuth workflow if desired.

* Update Pagerduty.php

Fixed spacing.
2020-05-01 22:03:11 -05:00
Heath Barnhart
10660261df pagerduty transport uses template message (#11459) 2020-04-21 23:48:23 +02:00
Tony Murray
1c08c11a77 Remove Laravel helpers (#11428)
* Remove Laravel helpers

* Replace qualifier with import
2020-04-18 00:37:56 +02:00
Adam Bishop
492ab32b6d Add support for sending events to Sensu (#11383)
* Add support for sending events to Sensu

Sensu is an alerting and monitoring service (and much more) that has a
nagios compatible check API.

This transport translates LibreNMS alerts into Sensu events, and sends
them to the agent API running on the same host as the poller.

The transport has a few options, but none of them are required - if the
Sensu agent is correctly configured, alerts will be sent as soon as the
transport is enabled.

There's a fair amount of code, as I've tried to translate as much data as
possible between LibreNMS and Sensu.

* Update Transports.md

* If alerted is 0, send an "ok" alert dated rrd.step / 2 seconds ago

This makes Sensu aware of the last time the check ran successfully (ish).
If we don't send the initial "ok", Sensu will either display 'unknown',
or an incorrectly high duration for the incident.

Alerted gets set to 1 after the first alert is sent.

We choose rrd.step / 2 as:
 * rrd.step is the maximum time ago the check could have succeeded
 * we halve it, so that if a check is flapping, it is not masked

Basically, we guess that the check fails around halfway through the time
since the poller last ran.

* Add additional metadata

* Improve codeclimate slightly

* Consider names that are 2 or 3 components long
2020-04-11 14:29:13 -05:00
Tony Murray
4d5ebfb561 Alert Rules use Carbon
Use carbon for time queries, need to be careful of timezone quirks.  Timestamps won't have that issue
2020-04-07 00:02:16 -05:00
SourceDoctor
5bfc44f812 Location based Alert Rule (#11128)
* Location base Alert Rule

* travis fix
2020-02-12 12:53:26 -06:00
Joe Clarke
0a34322877 Do not strip tags when markdown is in use. (#11075)
Markdown supports limited HTML tags, which can help enrich messages.
Additionally, eliminate extra whitespace when markdown is used as that
will have weird output effects.
2020-01-29 05:59:23 -06:00
SpaceDump
25920be1db Added fix for escaping underscore while using Markdown (#11070)
* Added fix for escaping underscore while using Markdown

* Corrected indentation
2020-01-26 08:05:49 -06:00