Commit Graph

97 Commits

Author SHA1 Message Date
Tony Murray
61c89794e4
Remove debug globals (#12811)
* Remove $debug global
and $vdebug global
makes these variables more accessible and protects from collisions.

* the on boot set sends application as the first parameter, just handle that

* Relocate other debug related functions

* Log debug to stdout

* Wrong output

* remove stupid constants

* Fix lint and style issues
2021-04-29 22:42:18 -05: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
Hayden
25087a6828
added expiration for alerts cache::lock() (#12375) 2020-12-01 18:16:15 -06:00
Tony Murray
1e4702fa4f
Support multiple daily process locking backends with distributed polling (#11896)
* Implement locks in the file cache

* Replace custom locks

* implement restore lock
Used when re-hydrating

* remove legacy use statements

* Add class descriptions

* Fix style

* Default to database cache driver

* missed cache_locks table
prevent chicken-egg issue

* style fixes

* Remove custom file lock implementation

* missed items from file cache

* Update schema definition
hmm, other schema noise must be from manual modification as this is generated from a freshly migrated db.

* require predis, it is pure python, so no harm in adding

* and set predis as the default client
2020-10-07 07:36:35 -05:00
Jellyfrog
29f45ca352
Apply fixes from StyleCI (#12124) 2020-09-21 15:59:34 +02:00
Jellyfrog
77c531527c
Apply fixes from StyleCI (#12117)
* Apply fixes from StyleCI

* Disable style check
2020-09-21 14:54:51 +02:00
Heath Barnhart
851994cfb8 Alert Subsys to OOP and SNMPTraps trigger Alert Rules (#9765)
* Changed snmptrap.php and handlers to allow for alerts.

* Moved RunRules() to Dispatcher.php

* Modified includes, passes pre-commit tests locally.

* Converted RunRules to OO, fixed formatting in files found by TravisCI

* rebase, covert alert subsy to oop

* Modified init.php to call new Alert subsystem

* fixed dependencies

* Resolved undefined functions

* Fixed PingCheck.php not triggering

* Changed runAlerts to __construct

* Fixes
Can't have Config inside empty()
incorrectly named function (my fault)
poller.php missing shebang
organize imports
2019-07-18 08:36:02 -05:00
Tony Murray
f3ba8947f7
Use Config helper (#10339)
remove usage of global variable
2019-06-23 00:29:12 -05:00
Tony Murray
deb405fac9 Alert transport fixes (#8967)
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-31 21:53:03 +01:00
Neil Lathwood
ad6ec7f72a
Refactor alert templates to use Laravel Blade templating engine (#8803)
* Initial start on new templating support

* further updates

* more updates

* More working version

* Last fixes

* Small updates

* modified test to look for dbname.

* Schema update

* Added fix for not being able to disable Philips Hue transport

* Updated sql file

* Updated db_schema

* Set myclabs/deep-copy to be 1.7.x version in composer

* Fixes from murrant

* Forced nikic/php-parser to version 3.1.x in composer

* Updated composer to use custom fork of string-blade-compiler + fixed transport use

* Updated to always use correct template

* Merged legacy and blade templating engines

* Removed template type + fixed test-alert.php

* Added more template placeholders

* Added ability to reference data in templates as $alert->X

* Updated docs for templates

* Updated db_schema.yaml

* Added $alert->builder

* Clarify the use of $alert->builder

* Fixed the use of $alert->transport

* renamed schema file

* Added template validation

* Small update to fix travis issue

* Add Docs text to title bar

* Updated amqp to new of version

* Consistency in alert rule and template title bars
2018-07-14 22:15:43 +01:00
Tony Murray
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
Tony Murray
2e73b75297 fix: Use memcached to lock daily processes on Distributed Pollers (#7735)
* fix: use memcached to lock daily processes on Distributed Pollers

* All the locks!
2017-11-24 09:37:52 +00:00
keeperofdakeys
701fbbc29b feature: Add a new locking framework that uses flock. (#6858)
Change locks to use flock, as pid checking is not
sufficient when PID Namespaces are involved.
2017-07-02 23:44:36 -05:00
Neil Lathwood
0338734fe7 feature: Added script (scripts/test-template.php) to test alert templates (#6631)
* feature: Added script (scripts/test-template.php) to test alert templates

* moved remaining functions, fixed php 5.3 and include dir

* added docs on use for test-template script
2017-05-13 06:46:08 -05:00
Neil Lathwood
41e7689c77 refactor: DB Updates will now file level lock to stop duplicate updates (#6469)
* refactor: DB Updates will now file level lock to stop duplicate updates

* scrut fixes

* renamed function from clear_lock() to release_lock()
2017-05-03 14:48:23 +01:00
Neil Lathwood
af2930e0d9 fix: Clear out stale alerts (#6268) 2017-03-25 21:02:21 +00:00
Neil Lathwood
b30161b80c fix: Correct the use of GetContacts() #5012 (#6059)
* fix: Correct the use of GetContacts() #5012

* small update

* array set

* Properly check the results
2017-03-07 22:14:51 -06:00
Richard Mayhew
5bfd23e7eb webui: New eventlog severity classification (#5830)
* New event log severity model

* Revert "New event log severity model"

This reverts commit 0783527af8.

* New event log severity model

* Fixed spaces vs tabs

* Learning the format requirements

* Learning the format requirements

* Moved the colours in to the stylesheet

* change SQL file to stop conflicting

* refactor log_event so severity isn't last, but reference is.

* keep having to move the file due to new PR conflicts

* Revert "keep having to move the file due to new PR conflicts"

This reverts commit f3030e7218.

* extended support to dashboard and eventlog page

* formatting
2017-02-12 22:41:05 +00:00
Mickael Marchand
8352a3a000 fix: update any IP fields using inet6_ntop() #5207 2016-12-29 23:50:22 +00:00
Tony Murray
9a33464c52 refactor: Centralize includes and initialization (#4991) 2016-11-21 20:12:59 +00:00
Neil Lathwood
e934e306fc feature: Added formatted uptime value for alert templates #4983
feature: Added formatted uptime value for alert templates #4983
2016-11-15 22:11:12 +02:00
Neil Lathwood
e1fac851f9 refactor: Update alert rules to generate sql query and store in db (#4748) 2016-10-15 00:29:55 +01:00
Neil Lathwood
32ae45640e feature: Added support for show faults array in recovery alerts (#4708) 2016-10-04 06:53:08 +00:00
Vitali Kari
3680849206 feature: Add description and notes to be used in alerts templates (#4706) 2016-10-03 20:31:50 +01:00
Tony Murray
d2193f76ca feature: allow scripts to be run from any working directory (#4437)
* feature: allow validate.php to be run from any working directory

* remove redundant realpath() call

* re-add realpath() to remove symbolic links

* realpath() isn't needed...

* chdir() in all php scripts in ./ and ./scripts/

* update-sql.php clearly is not used, as it was broken.

* Change some scripts to executable
Remove extra chdir() call in snmp-scan.php

* Missed console-ui.php
Kind of fixed console-ui.php help output

* Re-add newline
2016-09-14 16:53:04 +01:00
Tony Murray
abc6a5b799 PSR-2 Final cleanup (#4247)
refactor: Final PSR2 cleanup
2016-08-28 23:32:55 +01:00
laf
9f130d53cf Added ability to use uptime in alerts template 2016-07-28 21:04:00 +01:00
laf
ea5512ffe6 Added location to be available in alerts template 2016-06-13 22:03:17 +00:00
laf
55063b8f8d Added ability to use sysName in templates 2016-05-02 19:15:58 +00:00
Robert Gornall
59ad5d06c4 Catch failed transports that don't return 'false'. Pass error message into event log. 2016-03-23 16:57:15 +00:00
Neil Lathwood
b8cdadaf04 Merge pull request #3148 from ekoyle/alert_template_transport
Alert template transport
2016-03-17 20:58:43 +00:00
Neil Lathwood
47b87e959e Merge pull request #3138 from f0o/minor-alerting-addons
Minor alerting addons
2016-03-08 21:00:37 +00:00
Eldon Koyle
94a182a396 Revert "Don't escape single quotes in alert templates so that we can compare strings in if statements"
This reverts commit 124afc2054.
2016-03-07 16:12:57 -07:00
Daniel Preussker
46bee4021f Changed else if to elseif 2016-03-04 16:25:51 +00:00
Daniel Preussker
29eea12b08 Scrut fixes 2016-03-04 14:36:47 +00:00
Ultra2D
9773b3bade Tabs to spaces 2016-03-04 11:30:11 +01:00
Eldon Koyle
124afc2054 Don't escape single quotes in alert templates so that we can compare strings in if statements 2016-03-03 11:02:17 -07:00
f0o
1dc99b83c5
Added %diff as placeholder for changed objects between worsens/betters
Added %elapsed in all cases
2016-03-02 16:53:53 +00:00
f0o
34e0146d8e
Added {calc} operation to produce inline calculations in templates 2016-03-02 16:33:46 +00:00
Eldon Koyle
b34ee3932f Add transport to alert_template vars 2016-03-01 15:33:34 -07:00
Daniel Preussker
731e43bc66 Revert "[WIP] Sanity!" 2016-02-17 13:59:58 +00:00
f0o
21e94b3e3a
Sanity! 2016-02-10 15:21:31 +00:00
laf
0558275414 Added verbose debugging, normal debugging will now try and mask certain information 2016-01-17 14:39:17 +00:00
f0o
bb112a97b0
HotFix remove empty transports with keys 2015-11-23 15:57:43 +00:00
laf
64180fa9a8 Added ability to globally disable sending alerts 2015-11-04 20:29:02 +00:00
f0o
38bd3cf763
fix a typo 2015-09-03 15:15:17 +01:00
Neil Lathwood
04bb652e06 Merge pull request #1817 from f0o/issue-1770
Only process followups if there are any results
2015-09-01 09:38:55 +01:00
f0o
a833d46d4d
Add placehoders to custom titles 2015-08-30 18:02:29 +01:00
f0o
9057d48273
Fix default template assignment 2015-08-30 17:07:02 +01:00
f0o
ac7d0c9420
Added user defined titles for alert templates 2015-08-30 16:53:34 +01:00