Commit Graph

114 Commits

Author SHA1 Message Date
Tony Murray
0658b56c77 Fix get_rrd_dir() function (#11310)
Thanks to @n0cturnal and @doGus on Discord for fixing this!
2020-03-19 22:08:42 -05: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
Joseph Tingiris
4246316cdb rrdtool.inc.php: in rrdtool_escape(), fix invalid length (#11001)
* rrdtool.inc.php: in rrdtool_escape(), fix invalid length

* in rrdtool_escape(), add more debug output

* in rrdtool_escape(), fix substr_count() for $string length < $length; remove debug
2020-01-07 20:06:55 +01:00
Tony Murray
f3ba8947f7 Use Config helper (#10339)
remove usage of global variable
2019-06-23 00:29:12 -05:00
Tony Murray
de56dccc8a refactor: Move config loading into the Config class. (#8100)
Self contain dbFacile too.
Update rrdtool default setting to be similar to others.
Move silly cisco-entities.php into entity-physical.inc.php
2018-02-10 20:38:25 +00:00
Tony Murray
11147d3bbf Major Processors rewrite (#8066)
* Extract DiscoveryItem and move some things to better places.
Extract model class
Fix up model construction.  I have problem with construction...
Makeshift model working.  Switch constructor to factory.  discover() and create()
Support legacy discovery.
Remove uneeded custom pollers
Remove netonix custom detection as we try ucd on all os now.
Add a few yaml procs.  Fix a couple things.
More processor discovery conversions
Move Calix e7 to standard hrProcessorLoad, but it doesn't fully implement the HR-MIB, move things around to make it work.
Add a few yaml procs.  Fix a couple things. Correct some stupid mib stuff.
Move more, drop php 5.3
Add netscaler which uses string indexes.  Port fiberhome to yaml and use skip_values
More conversions.  BroadcomProcessorUsage Trait
Serveriron and Ironware share some mibs.  Create a common abstract os for them.
Add yaml support for mib specification in each data entry
Make legacy discover_processor() set 0 for hrDeviceIndex

Untangle Dell switch OS processors

Use use shared OS for groups if they don't have a specific group.
fix silly mib mistake

Make index optional

Move HR and UCD to Traits and out of Processor.

* forgot to update the fortiswitch index

* Make sgos and avaya-ers match the old index.

* fix comware test data

* fix merge errors

* fix dsm and remove pointless empty modules

* file not found exception is in the wrong place.

* Updated processor development docs
2018-02-05 07:39:13 -06:00
Tony Murray
5ad28c9202 feature: Track rrdtool time for poller (#7706)
* feature: track rrdtool time for poller

* Removed var_dump()
2017-11-11 19:44:25 +00:00
Zmegolaz
5441bafc81 fix: Fixed IPv6 host renaming (#7275)
* Fixed IPv6 host renaming

* Added get_rrd_dir() and modified other files to use it where appropriate.

* rrd_name() now uses the new function get_rrd_dir(), to make it simpler to modify the escaping in the future.

* Wrong function name in rrdstep.php
2017-09-02 13:45:31 -05:00
Neil Lathwood
fad5aca1b7 feature: Allow customisation of rrd step/heartbeat when creating new rrd files (#5947)
* feature: Allow customisation of rrd step/heartbeat when creating new rrd files

* revert defaults

* added docs + webui config option

* Move RrdDefinition to an Object to make them easier to create and remove the possibility of typos.

* Fix style/lint issues and missing use statements

* 3 more missing use statements

* updated doc + moved schema file
2017-02-23 22:45:50 +00: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
Tony Murray
56bb0d2b97 fix: support hosts added by ipv6 without DNS #5567 2017-01-24 21:48:03 +00:00
David Bell
755860fec5 Improve the formating of some graphs (#5507) 2017-01-24 09:53:38 +00:00
Neil Lathwood
af0534f721 Revert "fix: possible additional fix for non-terminating rrdtool processes." 2016-09-24 15:52:35 +01:00
Tony Murray
37dba71101 fix: possible additional fix for non-terminating rrdtool processes.
Sends the quit command to the process, but doesn't call close as that can block the php process.
When the process exits all objects are destroyed and Proc::terminate() is called, this will terminate 15 then kill 9.
2016-09-23 16:47:14 -05:00
Tony Murray
833f509c36 Add type comments to the Proc objects in rrdtool.inc.php (#4383) 2016-09-09 07:29:02 +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
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
111d967e7d Fix remote rrdtool_check_rrd_exists() calls (#4196)
It was comparing with the full name when rrdcached only printed out the relative name.
Thanks mikmak on irc for lots of troubleshooting.
2016-08-24 22:42:50 +01:00
Tony Murray
228857d2da Use proc_terminate instead of proc_close to protect against zombies (#4178) 2016-08-23 15:23:55 +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
7941768933 Quick and dirty fix for #4102
Real fix is in #4104
2016-08-19 10:25:38 -05:00
Tony Murray
96e05cad0e Missed $vdebug in merge 2016-08-17 16:05:15 -05:00
Tony Murray
4f1a50a36e Make it easy to check for $debug condition for c_echo 2016-08-17 16:00:43 -05:00
Tony Murray
21514f1b69 Merge remote-tracking branch 'upstream/master' into rrd-check 2016-08-17 15:52:18 -05:00
Neil Lathwood
fdaad2e6ca Merge pull request #4075 from murrant/rrdoutput
Clean up rrdtool output
2016-08-17 21:05:20 +01:00
Tony Murray
aa8294bfce c_echo
Console_color2 helper.
If $console_color isn't instantiated, remove the color directives and print.
2016-08-16 20:01:22 -05:00
Tony Murray
4a152dab7b Fix rrdtool_check_rrd_exists() by removing the broken remote check.
Maybe this can be re-implemented at a later time.
2016-08-16 19:07:01 -05:00
Tony Murray
2528171e0a Clean up rrdtool output
Output the command before other print statements
Only output raw rrdtool output with the -v switch
Line return and plurality
2016-08-15 20:40:57 -05:00
Vladislav Solovei
ea7e02c66b -O does not exists in RRDTool < 1.4.3 (CentOS 6 uses 1.3.8 by default).
Checking RRD existence with file_exists() if RRDTool ver. < 1.5
2016-08-16 01:20:49 +03:00
Vladislav Solovei
de058b82ca -O does not exists in RRDTool < 1.4.3 (CentOS 6 uses 1.3.8 by default).
Checking RRD existence with file_exists() if RRDTool ver. < 1.5
2016-08-15 23:49:58 +03:00
Vladislav Solovei
fe948a7aad Removed -O parameter from rrdtool command line.
-O does not exists in RRDTool < 1.4.3 (CentOS 6 uses 1.3.8 by default).
Checking RRD file existence with rrdtool_check_rrd_exists() instead.
2016-08-15 18:32:49 +03:00
Vladislav Solovei
4c324cb5b3 Removed -O parameter from rrdtool command line.
-O does not exists in RRDTool < 1.4.3 (CentOS 6 uses 1.3.8 by default).
Checking RRD file existence with file_exists() instead.
2016-08-15 12:41:32 +03:00
Tony Murray
1949f2f4ea Proxmox rrd fix
Attempt to fix proxmox rrd naming. Create a separate function to generate it's file names.
2016-08-12 11:05:58 -05:00
Tony Murray
78723db9ea rrdtool.inc.php: Remove unused functions
Always force -O with create
Mark rrdtool() as internal
A little PSR-2 and whitespace cleanup
2016-08-09 09:31:45 -05:00
Tony Murray
837e360d5f Always send rrd create 2016-08-06 23:53:26 -05:00
Tony Murray
668c08193e Try to flush the output stream before we check it. 2016-08-03 16:40:31 -05:00
Tony Murray
ca89d7484a Update the rrdtool timeout to 5 seconds.
This should be adequate for most deployments.
2016-08-03 16:05:28 -05:00
Tony Murray
8d950a4ed7 More compact debug output.
RRDC_USER is not used in the systemd unit file (this isn't how you set an environment variable), so remove it.
2016-07-25 20:12:40 -05:00
Tony Murray
e3772e2653 Don't use $config['rrdcached_dir'] anymore, always use relative directories when using rrdcached.
Wait for output on every command, this prevents input left in the buffer from messing up subsequent commands.
It doesn't seem like there is a penalty, but I'd have to do more testing.
2016-07-25 16:24:09 -05:00
Tony Murray
c43f533b55 Sometimes the output streams already contain output, so we don't get the output we expect.
Clear those output buffers, but only when we care about it.
2016-07-21 11:27:19 -05:00
Tony Murray
0a8acc7649 Check for file missing string anywhere in stdout or stderr 2016-07-18 13:30:39 -05:00
Tony Murray
dd9e19d9ed Fix slow poller debug (waiting for output)
More robust rrdtool_check_rrd_exists() check
Line return after outputting the rrd command for easier to read debug output
Updated some phpdoc comments in rrdtool.inc.php
2016-07-15 12:21:09 -05:00
Tony Murray
01cfb960d1 Fix sensors rrd name issue
Use last instead of first, as last won't flush rrdcached
Only stream_select if timeout > 0
Attempt to fix mysql
2016-07-08 22:58:36 -05:00
Tony Murray
c5c5469179 Fix rrdtool_check_rrd_exists() 2016-07-08 14:35:00 -05:00
Tony Murray
57650e4ffc Remove nfs requirement for distributed poller (with rrdtool 1.5+)
Use data_update instead of rrd_update/rrd_create and influx_update
Centralize rrd file check so we can check against a remote rrdcached server too
Use rrd_name() to generate rrd file names
2016-07-07 21:10:06 -05:00
Paul Gear
7528453941 Remove null message on rename 2016-01-22 09:39:26 +10:00
Paul Gear
33091034d2 Record RRD renames in event log 2016-01-15 21:49:58 +10:00
Paul Gear
a78fac6d05 Allow ['rrd_def'] to be array or string 2016-01-15 21:49:58 +10:00