Commit Graph

98 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
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
Tony Murray
b9f80d32bd Fix unauthenticated graphs (#11879)
broken with security fix
2020-06-30 09:25:01 -05:00
Jellyfrog
659325d5d0 Prevent unauthorized access to device graphs
Users could access info for the wrong device by piggyback on port permissions
2020-06-30 13:35:45 +02:00
Tony Murray
df16de9d2f Refactor Datastores to allow future improvements. OpenTSDB Tags. (#11283)
* Datastores to object oriented code, using the Laravel IoC container

Change instantiation
better DI
move OpenTSDB

Small re-orgs

remove unused stuff

Fix graphs and other scripts

Use DI for all except rrd

fix up connection error handling

Add tests, fix up a "few" things
Add Config::forget()

Style fixes

Don't reference legacy code

remove accidental code paste

Add datastores phpunit groups

some tests

* rebase fixes

* some test fixes

* shorter tests

* shorter tests

* Don't except when rrdtool can't be started.

* restore tests

* fix rrd tests

* fix iterable change upstream

* fix isValidDataset

* fix invalid data bug

* fix mysql incorrect ds

* fix issue with data that is too long

* use regular data_update()

* Use log facade

* OpenTSDB mis-ordered arguments fix

* Making a singleton with different options makes different singletons.  Just use the global config settings to disable datastores.

* only filter tags for datastores that won't it don't modify the tags permanently

* Update copyrights to include original authors.

* Stats for all datastores

* Fix mysql sends different rrd / other ds names

* fix snmp last stats not initialized
remove unused function

* remove unused function and move single use function closer to its use

* InfluxDB does not need to update null or U values.
Skip write if all fields are empty

* Fix smart value checks

* fix style issues

* Make sure port data is stored the same way as before for Graphite and OpenTSDB
Add ifIndex tag to all to be compatible

* Missed rrdtool_tune() call

* Test update WIP

* OpenTSDB now includes tags

* fix style
2020-03-16 09:17:58 -05:00
Tony Murray
7fe895bd08 Revert "Refactor datastores to classes (#9179)" (#11273)
This reverts commit e5dad7a64e.
2020-03-11 07:52:52 -05:00
Tony Murray
e5dad7a64e Refactor datastores to classes (#9179)
* Datastores to object oriented code, using the Laravel IoC container

Change instantiation
better DI
move OpenTSDB

Small re-orgs

remove unused stuff

Fix graphs and other scripts

Use DI for all except rrd

fix up connection error handling

Add tests, fix up a "few" things
Add Config::forget()

Style fixes

Don't reference legacy code

remove accidental code paste

Add datastores phpunit groups

some tests

* rebase fixes

* some test fixes

* shorter tests

* shorter tests

* Don't except when rrdtool can't be started.

* restore tests

* fix rrd tests

* fix iterable change upstream

* fix isValidDataset

* fix invalid data bug

* fix mysql incorrect ds

* fix issue with data that is too long

* use regular data_update()

* Use log facade

* OpenTSDB mis-ordered arguments fix

* Making a singleton with different options makes different singletons.  Just use the global config settings to disable datastores.

* only filter tags for datastores that won't it don't modify the tags permanently

* Update copyrights to include original authors.

* Stats for all datastores

* Fix mysql sends different rrd / other ds names

* fix snmp last stats not initialized
remove unused function

* remove unused function and move single use function closer to its use

* InfluxDB does not need to update null or U values.
Skip write if all fields are empty

* Fix smart value checks

* fix style issues
2020-03-10 19:08:00 -05:00
Tony Murray
e99f421511 Remove legacy auth usage of $_SESSION (#10491)
* Remove auth use of $_SESSION

Will break plugins that depend on $_SESSION, Weathermap was already fixed.
Port them to use Auth::check()/Auth::user()/Auth:id()

* revert accidental replacement
2019-08-05 14:16:05 -05:00
Tony Murray
f3ba8947f7 Use Config helper (#10339)
remove usage of global variable
2019-06-23 00:29:12 -05:00
Tony Murray
36431dd296 Security fix: unauthorized access (#10091)
* Security fix: unauthorized access
Affects nginx users:
Moved php files outside of public html directory (Apache was protected by .htaccess)

Affects all users:
Some files did not check for authentication and could disclose some info.
Better checks before including files from user input

* git mv html/includes/ includes/html
git mv html/pages/ includes/html/
2019-04-11 23:26:42 -05: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
db240cb4eb refactor: Collection and output of db and snmp stats (#5049) 2016-11-23 06:57:19 +00:00
Tony Murray
9a33464c52 refactor: Centralize includes and initialization (#4991) 2016-11-21 20:12:59 +00:00
Neil Lathwood
7dec670494 refactor: Updated a lot of references to LibreNMS - copyright still left intact (#4339) 2016-09-08 08:12:23 -05:00
Tony Murray
200e670315 Fix defunct process issues: create Proc class (#4210)
* Proc class
Encapsulate processes in a class, when they go out of scope, we can use the __destruct() process to make sure the process terminates.

* Fix rrdtool_last checks failing

* Don't close rrdtool in rrd_graph
Try to start rrdtool process if they haven't been started yet
Remove some extra debug output

* phpdocs added
several cleanups
should still be functioning the same
Only open one  rrdtool process for graph.php
2016-08-26 07:50:29 +01:00
Tony Murray
7b93b564da Centralize class loader (#4169)
Move the classloader to as early as possible in defaults.inc.php
This should cover all application entrances.
Set install_dir based on the location of defaults.inc.php
2016-08-22 23:59:59 +01:00
Tony Murray
e80a385b7f RRDtool dual process (remote creation/check) (#4104)
* Prepare for dual rrdtool processes
Disabled at this time
Split out rrdtool version checks into rrdtool_create_command()
Tests for rrdtool_create_command()
Fixes a few small issues.

* Enable dual process and remote rrd check/creation

* remove full path for remote commands

* Doc updates
minor fix to rrdtool_tune()

* Set up bootstrap for phpunit
Fix issues with FileExistsException

* Attempt to fix phpunit

* Fix classloader and bootstrap to use full paths only (not depending on $config)

* Fix phpunit tests, config.php does not exist.
2016-08-22 16:32:05 +01:00
Tony Murray
b8e9b2d917 Implement an autoloader (#4140)
* Implement an autoloader

When cleaning up classes for psr2, things got a bit unwieldy, so I implemented a class autoloader.
I created a PSR-0 compliant LibreNMS directory and moved all classes there that made sense.
Implemented LibreNMS\ClassLoader which supports adding manual class mappings

This reduces the file includes needed and only loads classes when needed.

* Add teh autoloader to graph.php

* Add a small bit of docs
Fix incomplete class in includes/discovery/functions.inc.php
2016-08-21 14:07:14 +01:00
laf
5f8705bd37 Changed package names 2016-08-20 12:21:13 +01:00
Tony Murray
8c639aa5a4 PSR2 Cleanup: /html edition
Travis tests for code conformance. Ignore warnings for now.
Fixed all errors, left most warnings.
2016-08-18 21:29:30 -05:00
pblasquez
823177e877 Update graph.php 2016-02-17 13:06:46 -08:00
pblasquez
adedd872ae Update graph.php 2016-02-16 19:46:22 -08:00
Mike Rostermund
e2d1a8e7d9 Replaced custom utime() function with microtime(true) 2016-01-08 13:33:32 +01:00
Mark Schouten
4fa88bb928 Remove all unneeded if($debug)-statements and replace them with d_echo . html dir.. 2015-08-21 16:10:01 +02:00
Job Snijders
d8693f05ae Fix coding style part 2 2015-07-15 11:04:22 +02:00
Alexander Sosna
5a7988e2e4 chmod 0644 to php files not directly executed 2015-04-28 22:58:03 +02:00
laf
c1ef9b6808 Resolved a large number index issues and update Console_Color to V2 2015-03-01 18:04:57 +00:00
Paul Gear
afd00f8f3c Alternative fix for graph.php debug failing 2013-11-19 21:00:33 +10:00
Paul Gear
b630ed0ddc Revert "Fix failing script in debug mode"
This reverts commit e667899392, which
stopped the script from working in non-debug mode.
2013-11-19 20:58:20 +10:00
Paul Gear
e667899392 Fix failing script in debug mode 2013-11-19 09:18:43 +10:00
Paul Gear
3184a35268 Revert boilerplate changes 2013-10-29 05:38:12 +10:00
Brad Peczka
985330f638 Updated copyright and package notices. 2013-10-28 21:39:08 +08:00
Adam Amstrong
f768558e7e fix auth for graphs to allow cidr filter. fix schema 006
git-svn-id: http://www.observium.org/svn/observer/trunk@3169 61d68cd4-352d-0410-923a-c4978735b2b8
2012-05-11 15:21:42 +00:00
Adam Amstrong
dbf212f652 phpDocumentator headers. retire static-config. IF YOU ARE READING THIS, REMOVE IT FROM THE BOTTOM YOUR CONFIG.PHP. YES. YOU.
git-svn-id: http://www.observium.org/svn/observer/trunk@3150 61d68cd4-352d-0410-923a-c4978735b2b8
2012-05-09 10:01:42 +00:00
Tom Laermans
04ec17134b syntaxer run 1/<many>
git-svn-id: http://www.observium.org/svn/observer/trunk@2963 61d68cd4-352d-0410-923a-c4978735b2b8
2012-04-05 16:10:12 +00:00
Adam Amstrong
5b9e58ecd4 descriptions on graph page (none created yet)
git-svn-id: http://www.observium.org/svn/observer/trunk@2931 61d68cd4-352d-0410-923a-c4978735b2b8
2012-03-27 16:53:23 +00:00
Adam Amstrong
8c0392ffae spit out runtime for graph.php when debugging
git-svn-id: http://www.observium.org/svn/observer/trunk@2930 61d68cd4-352d-0410-923a-c4978735b2b8
2012-03-27 13:59:31 +00:00
Adam Amstrong
f22f4b12a6 acsw change, and improve debugging for rrdtool graphing
git-svn-id: http://www.observium.org/svn/observer/trunk@2816 61d68cd4-352d-0410-923a-c4978735b2b8
2012-01-12 12:51:21 +00:00
Adam Amstrong
51e242b896 FFFFFFFffffffuuuuuuuuuuuuuuuuuuuuuu
git-svn-id: http://www.observium.org/svn/observer/trunk@2028 61d68cd4-352d-0410-923a-c4978735b2b8
2011-04-05 14:16:27 +00:00
Tom Laermans
de7ff537cc revert r1957 patch
git-svn-id: http://www.observium.org/svn/observer/trunk@1960 61d68cd4-352d-0410-923a-c4978735b2b8
2011-03-23 09:54:56 +00:00
Geert Hauwaerts
6501cd29b5 - Code cleanup by Bastian Widmer.
git-svn-id: http://www.observium.org/svn/observer/trunk@1957 61d68cd4-352d-0410-923a-c4978735b2b8
2011-03-22 20:27:39 +00:00
Tom Laermans
a32bff3c81 html pages cleanup
git-svn-id: http://www.observium.org/svn/observer/trunk@1902 61d68cd4-352d-0410-923a-c4978735b2b8
2011-03-17 11:48:03 +00:00
Adam Amstrong
ada14bd542 Major changes to graphing system organisation. Prevent sensors from being discovered in ENTITY-SENSOR-MIB if they've already been detected in CISCO-ENTITY-SENSOR-MIB (they share entPhysicalIndex). Fix ADSL poller. Make popup overlibs prettier as default.
git-svn-id: http://www.observium.org/svn/observer/trunk@1470 61d68cd4-352d-0410-923a-c4978735b2b8
2010-07-24 19:14:41 +00:00
Adam Amstrong
c5f7f9ac5f rrdcached support (yarly!)
git-svn-id: http://www.observium.org/svn/observer/trunk@1291 61d68cd4-352d-0410-923a-c4978735b2b8
2010-07-04 21:09:22 +00:00
Adam Amstrong
19ccf99d8f unify $os_group and $os_type into $config['os']
git-svn-id: http://www.observium.org/svn/observer/trunk@1264 61d68cd4-352d-0410-923a-c4978735b2b8
2010-06-25 12:18:00 +00:00
Tom Laermans
ccda0e3966 forgot to remove removed files from graph.php, broken graphs, woopsie.
git-svn-id: http://www.observium.org/svn/observer/trunk@1201 61d68cd4-352d-0410-923a-c4978735b2b8
2010-06-18 14:15:12 +00:00
Adam Amstrong
d33dfc87a1 fix load graph (fixed per-os specific graphs for device-level graphs *only*)
git-svn-id: http://www.observium.org/svn/observer/trunk@1157 61d68cd4-352d-0410-923a-c4978735b2b8
2010-06-12 18:14:59 +00:00
Tom Laermans
2df0add71a revert 'rrdtool -' change for now
git-svn-id: http://www.observium.org/svn/observer/trunk@1129 61d68cd4-352d-0410-923a-c4978735b2b8
2010-06-10 14:52:46 +00:00