Commit Graph

63 Commits

Author SHA1 Message Date
Tony Murray
a40e1d551e
Remove billing schema check (#14209)
Not needed
2022-08-15 19:16:05 -05:00
Tony Murray
df5096e449
Install: Validate database before migrating (#12867)
* Validate database during install
Needed to remove usages of legacy functions in the validation

* Fix output, restore real versions
2021-05-13 07:18:54 -05:00
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
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
Tony Murray
0d61deb8f0
Remove perf_times table (#12517)
the data is never used... This type of data is better to store in rrd anyway
2021-02-09 12:47:05 -06: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
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
ccperilla
21a8ebc31e SNMP counters validation (#11037)
* SNMP counters validation

Validation step added before counters are updated in table 'bill_port_counters'.

Avoid wrong data to be added to the table in case the SNMP polling function return an invalid value.

check --> https://community.librenms.org/t/wrong-billing-record-in-delta/8540

* SNMP counters validation #11037

--> Fixed lin identation.

*Updated message to be printed out in logs.

* SNMP counters validation #11037

Fixed blank spaces.

* SNMP counters validation #11037

Removing white spaces

* SNMP counters validation #11037

Sorry, more white spaces...
2020-01-24 05:44:55 -06:00
Tony Murray
f3ba8947f7
Use Config helper (#10339)
remove usage of global variable
2019-06-23 00:29:12 -05:00
Tony Murray
a60dda8217 Added cli options debug and bill_id to poll-billing.php (#9042)
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-08-25 21:57:08 +01:00
Tony Murray
29d51f4727 Workaround for billing with large bps (#9044)
* Workaround for billing with large bps
Workaround for mysqli driver mucking up BIGINT
Real fix is for users to switch to mysqlnd

* Add note

* More bigints
2018-08-21 00:00:02 +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
72ce39cf9b refactor: schema updates (#6370)
Test the schema files with STRICT_TRANS_TABLES and fix any issues
2017-04-13 10:18:12 +01:00
Neil Lathwood
d5296319fb refactor: MySQL strict and query fixes (#5338)
* refactor: MySQL strict and query fixes

* moved sql file
2017-01-13 06:47:16 -06:00
Tony Murray
9a33464c52 refactor: Centralize includes and initialization (#4991) 2016-11-21 20:12:59 +00: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
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
abc6a5b799 PSR-2 Final cleanup (#4247)
refactor: Final PSR2 cleanup
2016-08-28 23:32:55 +01: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
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
Karsten Schmidt
09b4497778 When ifSpeed is not returned by the switch, billing was broken. 2016-08-01 14:46:33 +02:00
laf
5a9a963a03 Final fixes for billing 2016-07-17 20:35:50 +01:00
laf
47f7c37b03 Updated code to detect bad data 2016-07-17 07:16:38 +01:00
laf
e5e1e89331 Sanity check the in/out_delta value, if it's out of the range of the
ifSpeed then we use the previous value
2016-06-15 16:25:14 +00:00
laf
bc26c910ef Fixed issue with new bills not grabbing data 2016-04-21 11:37:46 +00:00
Richard
042ddaa6fe Remove duplicate data from bill_data and add PK to prevent recurrence 2016-03-07 18:31:12 +00:00
Richard
19e9cda8d0 Replace port_in/out_measurements with latest values only 2016-03-07 18:31:12 +00:00
Richard
648db1e455 Fix previous delta being reported when no traffic passed 2016-03-01 12:41:41 +00:00
Job Snijders
d8693f05ae Fix coding style part 2 2015-07-15 11:04:22 +02:00
Neil Lathwood
a507ac2479 Move the \$now variable to where it is needed 2015-02-18 18:34:57 +00:00
Tyler Christiansen
63d428c0e1 Revert "update copyright notice" after discussion with Paul
This reverts commit 774233327e.
2013-10-28 12:01:36 -07:00
Tyler Christiansen
774233327e update copyright notice 2013-10-28 01:46:59 -07:00
Adam Amstrong
8c83b6a3c7 update foundry mibs
git-svn-id: http://www.observium.org/svn/observer/trunk@3250 61d68cd4-352d-0410-923a-c4978735b2b8
2012-05-29 13:08:01 +00:00
Adam Amstrong
4db1454e92 move from port_id to interface_id. make ports discovery only discover. add some cleaner functions. add a tiny bit of alerting infrastructure.
git-svn-id: http://www.observium.org/svn/observer/trunk@3195 61d68cd4-352d-0410-923a-c4978735b2b8
2012-05-16 13:25:50 +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
6b210ea056 change directory to observium root, now also for other commandline tools
git-svn-id: http://www.observium.org/svn/observer/trunk@2990 61d68cd4-352d-0410-923a-c4978735b2b8
2012-04-08 10:44:41 +00:00
Tom Laermans
ed6ffa6067 syntaxer run
git-svn-id: http://www.observium.org/svn/observer/trunk@2964 61d68cd4-352d-0410-923a-c4978735b2b8
2012-04-05 16:17:41 +00:00
Adam Amstrong
a1e96f708f billing rewrite (disabling svn after)
git-svn-id: http://www.observium.org/svn/observer/trunk@2758 61d68cd4-352d-0410-923a-c4978735b2b8
2011-12-06 22:17:37 +00:00
Adam Amstrong
d94b0bd1c2 add bill from device/port, some billing changes
git-svn-id: http://www.observium.org/svn/observer/trunk@2756 61d68cd4-352d-0410-923a-c4978735b2b8
2011-12-05 12:15:41 +00:00
Tom Laermans
a369c442eb syntaxer run
git-svn-id: http://www.observium.org/svn/observer/trunk@2643 61d68cd4-352d-0410-923a-c4978735b2b8
2011-10-04 14:38:54 +00:00
Adam Amstrong
66dd6dbd61 use rrdtool pipe in poller.
git-svn-id: http://www.observium.org/svn/observer/trunk@2631 61d68cd4-352d-0410-923a-c4978735b2b8
2011-10-01 14:54:06 +00:00
Tom Laermans
f87ed09e1b more code cleanup
git-svn-id: http://www.observium.org/svn/observer/trunk@2519 61d68cd4-352d-0410-923a-c4978735b2b8
2011-09-20 14:34:27 +00:00
Tom Laermans
d864ce234f kill a whole bunch of trailing spaces
git-svn-id: http://www.observium.org/svn/observer/trunk@2516 61d68cd4-352d-0410-923a-c4978735b2b8
2011-09-20 09:55:11 +00:00
Adam Amstrong
b03bb8181c fixes to billing. add realtime graphs for port bits.
git-svn-id: http://www.observium.org/svn/observer/trunk@2424 61d68cd4-352d-0410-923a-c4978735b2b8
2011-09-08 02:57:02 +00:00
Adam Amstrong
164ada67d7 no debug!
git-svn-id: http://www.observium.org/svn/observer/trunk@2301 61d68cd4-352d-0410-923a-c4978735b2b8
2011-05-13 12:36:25 +00:00
Adam Amstrong
72d0af238c fix poll-billing to use db*
git-svn-id: http://www.observium.org/svn/observer/trunk@2300 61d68cd4-352d-0410-923a-c4978735b2b8
2011-05-13 12:34:37 +00:00
Tom Laermans
f55a30f744 some formatting cleanups, introduce some more FIXMEs to look at, plus replace mysql_fetch_array by mysql_fetch_assoc, for great justice
git-svn-id: http://www.observium.org/svn/observer/trunk@2029 61d68cd4-352d-0410-923a-c4978735b2b8
2011-04-06 13:54:50 +00:00