Commit Graph

219 Commits

Author SHA1 Message Date
Alexandre Novakovski
48be858bf2 Telegram: Add support for topics (#14804) 2023-01-26 15:28:41 +00:00
Tony Murray
1d3440b943 Unify time interval formatting (#14733)
* Unify time interval formatting
Use carbon for formatting, it supports locales.

* fix style

* remove baseline exceptions

* fixes found by lint
2022-12-15 15:52:53 -06:00
Jellyfrog
71d740770b Remove Log::event (#14526)
* Remove Log::event

Use the Eventlog class directly instead

* wip

* wip

* wip

* Apply fixes from StyleCI

* Update Eventlog.php
2022-11-09 09:47:19 +01:00
Tony Murray
15a41c9164 Fix xss in browser push transport (#14470)
Escape html when populating user list.
2022-10-17 12:32:16 -05:00
Tony Murray
964a67289a Populate the alert rule field with the builder json (#14374)
That way it isn't empty. (which is unexpected)
2022-10-02 00:02:08 -05:00
Kayck Matias
64dcfcb8cc Alert map location fix (#14380)
* Update devices in alert-logs to init_select2

* Fix function ->exists

* Add init_select2 to location filter in ports

* fixes

* Fixed alerts rule system not filtering by location
2022-09-23 14:15:46 -05:00
Jellyfrog
152497a098 PHPStan: Enable more checks (#14318)
* PHPStan: Enable more checks

* Fixes

* Fixes

* Deprecation fixes
2022-09-09 07:08:06 -05:00
Tony Murray
302a989d4e Email Transport: embed graphs by default (#14270)
* Email embed graphs

* Allow attachment for non-html
Add setting to webui
Correct $auth setting

* Cleanups, throw RrdGraphException instead of returning an error image.
Generate the error image later, giving more control.
Reduce code duplication a little

* Style and lint fixes
Change to flags

* Add baseline for lint errors I don't know how to resolve

* oopsie, changed the code after generating the baseline

* Tiny cleanups.  Make set DeviceCache primary, it is free.

* Docs.

* email_html note

* Allow control of graph embed at the email transport level to override the global config.

* Allow control of graph embed at the email transport level to override the global config.

* Add INLINE_BASE64 to make it easier to create inline image tags
2022-09-05 20:41:55 -05:00
Tony Murray
ec8629fb63 Discord ability to attach graph images (#14276)
* Discord ability to attach graph images
Must use @signedGraphTag()
Needs more work on the graph side of things still: issues with CORs and other.

* Fixes

* alert data is an array for transports

* No need to decode, that was a bug before
2022-09-05 16:20:10 -05:00
Tony Murray
ef1076dd7b Cleanup some RunAlerts issues (#14274) 2022-09-03 03:19:21 +03:00
Nash Kaminski
797fe7477d Improvements to PagerDuty alert formatting (#14143)
* Split PagerDuty payloads into an array delimited by newlines

* Remove empty lines in PagerDuty message
2022-07-27 02:51:02 -05:00
Marek Wobst
207aaf3064 Add rich (=html) support for messages via Matrix (#14054)
Mails may be colorful now, too.
2022-07-20 23:05:38 -05:00
Tony Murray
9f749ae778 Update Larastan (#14031)
* Update Larastan

* fix as many as I can

* update baseline for the remaining

* fix style

* Update Log::event phpdoc
2022-06-13 08:57:21 +02:00
Nash Kaminski
24e1c96790 Allow the use of a custom URL for accessing the PagerDuty API and correct API schema violation (#14010)
* Allow the use of a custom URL for accessing PagerDuty

* styleci

* PagerDuty custom details must be an Object, not string

* styleci
2022-06-04 13:54:35 -05:00
TheMysteriousX
afe3a25738 Use display name when sending alerts to Sensu (#13967)
* Use display name when sending alerts to Sensu

* system->hostname should always be an FQDN or IP
2022-05-27 09:07:29 -05:00
DaftBrit
cedaf8e3ae Setting card summary to alert title (#13989) 2022-05-24 12:21:09 +02:00
TheMysteriousX
95aaa31dd9 Sensu: Correct type hint (#13915)
* Correct type annotation

Not 100% sure this is correct as I don't know what the previous change was trying to correct - but they're definitely not all strings.

* Correct the correction
2022-04-13 14:25:56 +02:00
geg347
ef12e5f980 Added Basic authentication capability to Alertmanager Transport (#13867)
* Adding Basic authentication capability to Alertmanager's Transport

* Fix PHPStan linting error

* Fix StyleCI error

* Fix StyleCI error part 2
2022-03-31 21:45:44 +01:00
MrXermon
40ff020433 Fixed #13851. (#13852) 2022-03-15 22:36:48 +01:00
geg347
9036fd53b4 Added extra dynamic values alerttransport alertmanager (#13828)
* Add extra dynamic values to Alert transport for Alertmanager

* Add description to explain how extra dynamic values for Alertmanager works in the WebUI

* Add _ in dynamic label name + fix continuous-itegration error

* Fix continuous-itegration error part 2

* Updating AlertManager docs with explanation of how dynamic variables works
2022-03-14 21:39:00 +00:00
Jellyfrog
1debe5e166 Use built in method to render a string with Blade (#13688) 2022-01-26 07:10:06 -06:00
Tony Murray
3c0831c821 Use display name in alerts (#13650)
* Use display name in alerts

* remove error from baseline
2022-01-04 23:40:42 +00:00
Tony Murray
c79b187d72 Poller rewrite (Try 2) (#13525)
* core WIP

* try to finish up

* trim space too
and a couple of cleanups

* update test data

* put escapes back

* another net-snmp difference

* correct copy paste error

* WIP

* Use new code YAY

* a tiny bit more

* Kind of working

* Handle manual modules correctly

* convert core to modern module

* Only save metrics if modules is not overridden

* correct module exists check

* database error handling

* debug handling

* restore bad changes

* Introduce Actions
 RunAlertRulesAction
 UpdateDeviceGroupsAction

* tweaks to output

* Fix some issues in outside code

* Style fixes

* fixes to module status checks

* typehints!

* Use logger only and DI

* OS module not named correctly

* Work on quiet output a bit more

* generically don't change output when disabling debug if the driver is already stack

* Fix missing $device variable for legacy os polling
Fix missing dbFacile functions when no legacy modules polled in RunAlertRulesAction

* restore legacy os module shim

* use the new poller code for tests

* PollingDevice event

* Fix some issues and enable/disable error reporting around legacy modules

* typehints

* fully update baseline

* Use Process for version commands so we don't leak debug output.

* don't detect rrdtool version in ci every time

* style fixes

* Warning fixes

* more fixes

* re-update baseline

* remove diff noise

* fix up alerts

* Catch exceptions in device ip lookup

* Revert accidental snmp.inc.php poller target change
(should have been ?: not ??)
2021-11-17 19:23:55 -06:00
Tony Murray
f8764ddcb5 Revert "Poller command rewrite (#13414)" (#13524)
This reverts commit 1752d1efd4.
2021-11-16 21:40:29 -06:00
Tony Murray
1752d1efd4 Poller command rewrite (#13414)
* core WIP

* try to finish up

* trim space too
and a couple of cleanups

* update test data

* put escapes back

* another net-snmp difference

* correct copy paste error

* WIP

* Use new code YAY

* a tiny bit more

* Kind of working

* Handle manual modules correctly

* convert core to modern module

* Only save metrics if modules is not overridden

* correct module exists check

* database error handling

* debug handling

* restore bad changes

* Introduce Actions
 RunAlertRulesAction
 UpdateDeviceGroupsAction

* tweaks to output

* Fix some issues in outside code

* Style fixes

* fixes to module status checks

* typehints!

* Use logger only and DI

* OS module not named correctly

* Work on quiet output a bit more

* generically don't change output when disabling debug if the driver is already stack

* Fix missing $device variable for legacy os polling
Fix missing dbFacile functions when no legacy modules polled in RunAlertRulesAction

* restore legacy os module shim

* use the new poller code for tests

* PollingDevice event

* Fix some issues and enable/disable error reporting around legacy modules

* typehints

* fully update baseline

* Use Process for version commands so we don't leak debug output.

* don't detect rrdtool version in ci every time

* style fixes

* Warning fixes

* more fixes

* re-update baseline

* remove diff noise

* fix up alerts
2021-11-16 16:59:46 -06:00
djamp42
c61ccf5c48 Change text to show alert termplate msg (#13521)
In the initial pull request this was brought up but never addressed, https://github.com/librenms/librenms/pull/9305#issuecomment-427930650  The only reason i can think of is due to SMS message length, but you could be mindful of that with a alert template.  Submitting this to see if anyone objects to changing it.
2021-11-16 17:48:01 +01:00
Tony Murray
1ff48018fa Fix slack errors when variables are not set (#13476) 2021-11-05 22:30:30 -05:00
Tony Murray
0862496e26 Fix api transport mult-line parsing (#13469)
* API transport fix parsing
parse templates after parsing user options, not before

* API transport tests

* fix style and lint

* remove accidental item

* fix more type issues
2021-11-03 13:37:57 -05:00
Tony Murray
2c77edf4d2 Better handling of some alerting errors (#13446)
* Better handling of some alerting errors

* Better error output

* Consolidate simple template parsing

* Fixes reported by phpstan (one was a bug, yay!)

* add back forgotten trim

* don't remove the template if there is no match

* Match previous behavior, which was inconsistent.

* use anonymous class for tests instead

* Oopsie, Stringable is PHP8+

* fix style
2021-10-29 22:12:20 -05:00
Hannele Kormano
688ec422de Drop PDConnect Install links (#13407)
* Drop PDConnect Install links

This flow has been removed.

* Update some terminology while I'm here

History time notes just for fun: 
 - it was called "service key" when you could only have one integration per service
 - it was called "integration key" when you could only have integrations on services
 - it's now called "routing key" to be inclusive of account-level routing keys

* Delete some code that should be unused now

* Tidy up imports

* I think these are also unused now
2021-10-22 19:53:36 +02:00
Tony Murray
0b8b97bb68 Push Notifications (Mobile and PC) (#13277)
* Update manifest and add service worker
cleanup icons a bit

* Push notifications WIP

* navigate working

* cleanup

* acknowledge wired up

* Set VAPID keys on composer install

* Component to control notification permissions.

* Allow all user option to validate

* Enable on browser load if transport exists.

* Check for transport before showing user permissions
translations

* Documentation

* style fixes

* access via the attribute model

* fix alerting test

* update schema

* cleanup subscription on disable

* non-configurable db and table for webpush subscriptions (respect system connection)

* revert AlertTransport change
hopefully phpstan can figure it out

* phpstan fixes

* Support custom details display

* Match transport names to brand's preferred display

* less duplicate id errors

* Tests are done in Laravel code now so
remove legacy function usage... could be better, but ok

* Style fixes

* Style fixes 2

* Fix alert test

* Doc updates requires HTTPS and GMP

* unregister subscription when permission is set to denied

* cleanup after user deletion

* delete the right thing

* fix whitespace

* update install docs to include php-gmp

* suggest ext-gmp

* update javascript

* Update functions.php

Co-authored-by: Jellyfrog <Jellyfrog@users.noreply.github.com>
2021-10-06 07:29:47 -05:00
La
e5f540eed8 fix alert transport api with POST method (#13288) 2021-10-02 23:56:49 +02:00
ottorei
b2d34cac4a Fix PagerDuty transport's group field (#13235)
* Do not poll passive interfaces

* Bug

* Update payload
2021-09-13 21:14:11 +02:00
Jellyfrog
258505ed44 Apply fixes from StyleCI (#13224) 2021-09-10 20:09:53 +02:00
Jellyfrog
26b95c0ccc Apply fixes from StyleCI (#13208) 2021-09-08 23:35:56 +02:00
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