From fad5aca1b716a9c720bf08571e4229d16ca317a2 Mon Sep 17 00:00:00 2001 From: Neil Lathwood Date: Thu, 23 Feb 2017 22:45:50 +0000 Subject: [PATCH] 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 --- .../Exceptions/InvalidRrdTypeException.php | 31 ++++ LibreNMS/RRD/RrdDefinition.php | 109 ++++++++++++ doc/Support/1-Minute-Polling.md | 15 ++ doc/Support/Configuration.md | 69 ++++--- html/pages/settings/external.inc.php | 9 + includes/datastore.inc.php | 2 +- includes/defaults.inc.php | 3 +- includes/polling/applications/apache.inc.php | 45 ++--- includes/polling/applications/bind.inc.php | 25 +-- includes/polling/applications/ceph.inc.php | 27 ++- .../polling/applications/dhcp-stats.inc.php | 24 +-- includes/polling/applications/drbd.inc.php | 26 +-- .../polling/applications/exim-stats.inc.php | 9 +- .../polling/applications/freeswitch.inc.php | 20 ++- includes/polling/applications/gpsd.inc.php | 15 +- .../polling/applications/mailscanner.inc.php | 19 +- .../polling/applications/memcached.inc.php | 41 ++--- includes/polling/applications/mysql.inc.php | 168 +++++++++--------- .../polling/applications/nfs-stats.inc.php | 36 ++-- .../polling/applications/nfs-v3-stats.inc.php | 112 ++++++------ includes/polling/applications/nginx.inc.php | 15 +- .../polling/applications/ntp-client.inc.php | 16 +- .../polling/applications/ntp-server.inc.php | 34 ++-- .../polling/applications/os-updates.inc.php | 6 +- includes/polling/applications/php-fpm.inc.php | 22 +-- .../applications/powerdns-recursor.inc.php | 125 ++++++------- .../polling/applications/powerdns.inc.php | 50 +++--- includes/polling/applications/proxmox.inc.php | 9 +- .../polling/applications/rrdcached.inc.php | 23 +-- .../polling/applications/shoutcast.inc.php | 22 +-- includes/polling/applications/tinydns.inc.php | 45 ++--- includes/polling/applications/unbound.inc.php | 42 ++--- .../polling/applications/ups-apcups.inc.php | 19 +- includes/polling/applications/ups-nut.inc.php | 23 ++- includes/polling/aruba-controller.inc.php | 29 +-- includes/polling/bgp-peers.inc.php | 28 +-- includes/polling/cipsec-tunnels.inc.php | 8 +- .../polling/cisco-ace-loadbalancer.inc.php | 8 +- .../polling/cisco-ace-serverfarms.inc.php | 8 +- includes/polling/cisco-asa-firewall.inc.php | 4 +- includes/polling/cisco-cbqos.inc.php | 11 +- includes/polling/cisco-cef.inc.php | 11 +- .../polling/cisco-ipsec-flow-monitor.inc.php | 47 ++--- includes/polling/cisco-mac-accounting.inc.php | 13 +- includes/polling/cisco-otv.inc.php | 6 +- .../cisco-remote-access-monitor.inc.php | 17 +- includes/polling/cisco-sla.inc.php | 52 +++--- .../polling/cisco-voice/cisco-iosdsp.inc.php | 9 +- .../polling/cisco-voice/cisco-iosmtp.inc.php | 9 +- .../polling/cisco-voice/cisco-iospri.inc.php | 9 +- .../cisco-voice/cisco-iosxcode.inc.php | 9 +- includes/polling/cisco-vpdn.inc.php | 11 +- includes/polling/core.inc.php | 4 +- includes/polling/entity-physical/ios.inc.php | 15 +- includes/polling/functions.inc.php | 25 +-- includes/polling/hr-mib.inc.php | 6 +- includes/polling/ipSystemStats.inc.php | 7 +- includes/polling/ipmi.inc.php | 4 +- includes/polling/junose-atm-vp.inc.php | 21 +-- includes/polling/loadbalancers/f5-ltm.inc.php | 35 ++-- includes/polling/mempools.inc.php | 9 +- includes/polling/mib/siklu-mib.inc.php | 8 +- includes/polling/netscaler-vsvr.inc.php | 12 +- .../polling/netstats/netstats-icmp.inc.php | 7 +- includes/polling/netstats/netstats-ip.inc.php | 7 +- .../netstats/netstats-ip_forward.inc.php | 4 +- .../polling/netstats/netstats-snmp.inc.php | 7 +- .../polling/netstats/netstats-tcp.inc.php | 7 +- .../polling/netstats/netstats-udp.inc.php | 7 +- includes/polling/ntp.inc.php | 8 +- includes/polling/ntp/cisco.inc.php | 13 +- includes/polling/os/ciscowlc.inc.php | 28 +-- includes/polling/os/fortigate.inc.php | 7 +- .../polling/os/misc/netscaler-stats.inc.php | 28 ++- includes/polling/os/nios.inc.php | 52 +++--- includes/polling/os/panos.inc.php | 6 +- includes/polling/os/procurve.inc.php | 4 +- includes/polling/os/pulse.inc.php | 6 +- includes/polling/os/riverbed.inc.php | 39 ++-- includes/polling/os/screenos.inc.php | 11 +- includes/polling/os/sgos.inc.php | 5 +- includes/polling/os/snom.inc.php | 17 +- includes/polling/os/sonicwall.inc.php | 9 +- includes/polling/os/waas.inc.php | 4 +- includes/polling/os/zywall.inc.php | 4 +- includes/polling/ospf.inc.php | 13 +- includes/polling/ports.inc.php | 35 ++-- includes/polling/ports/port-adsl.inc.php | 51 +++--- includes/polling/ports/port-etherlike.inc.php | 15 +- includes/polling/ports/port-poe.inc.php | 13 +- includes/polling/processors.inc.php | 4 +- includes/polling/storage.inc.php | 9 +- includes/polling/toner.inc.php | 4 +- includes/polling/ucd-diskio.inc.php | 13 +- includes/polling/ucd-mib.inc.php | 43 +++-- includes/polling/unix-agent.inc.php | 4 +- .../polling/unix-agent/munin-plugins.inc.php | 4 +- includes/polling/wifi.inc.php | 4 +- includes/polling/wireless/cambium-250.inc.php | 29 ++- includes/polling/wireless/cambium-650.inc.php | 26 +-- .../polling/wireless/cambium-epmp.inc.php | 45 +++-- .../polling/wireless/cambium-generic.inc.php | 89 +++++----- .../polling/wireless/canopy-generic.inc.php | 94 +++++----- includes/polling/wireless/cisco-wwan.inc.php | 6 +- includes/polling/wireless/xirrus.inc.php | 13 +- includes/rrdtool.inc.php | 10 +- includes/services.inc.php | 8 +- includes/snmp.inc.php | 24 ++- sql-schema/167.sql | 1 + tests/RrdDefinitionTest.php | 66 +++++++ 110 files changed, 1475 insertions(+), 1119 deletions(-) create mode 100644 LibreNMS/Exceptions/InvalidRrdTypeException.php create mode 100644 LibreNMS/RRD/RrdDefinition.php create mode 100644 doc/Support/1-Minute-Polling.md create mode 100644 sql-schema/167.sql create mode 100644 tests/RrdDefinitionTest.php diff --git a/LibreNMS/Exceptions/InvalidRrdTypeException.php b/LibreNMS/Exceptions/InvalidRrdTypeException.php new file mode 100644 index 0000000000..e91f1572dc --- /dev/null +++ b/LibreNMS/Exceptions/InvalidRrdTypeException.php @@ -0,0 +1,31 @@ +. + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2017 Tony Murray + * @author Tony Murray + */ + +namespace LibreNMS\Exceptions; + +class InvalidRrdTypeException extends \Exception +{ + +} diff --git a/LibreNMS/RRD/RrdDefinition.php b/LibreNMS/RRD/RrdDefinition.php new file mode 100644 index 0000000000..1d7bbf2432 --- /dev/null +++ b/LibreNMS/RRD/RrdDefinition.php @@ -0,0 +1,109 @@ +. + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2017 Tony Murray + * @author Tony Murray + */ + +namespace LibreNMS\RRD; + +use LibreNMS\Exceptions\InvalidRrdTypeException; + +class RrdDefinition +{ + private static $types = array('GAUGE', 'DERIVE', 'COUNTER', 'ABSOLUTE', 'DCOUNTER', 'DDERIVE'); + private $dataSets = array(); + + /** + * Make a new empty RrdDefinition + */ + public static function make() + { + return new self(); + } + + /** + * Add a dataset to this definition. + * See https://oss.oetiker.ch/rrdtool/doc/rrdcreate.en.html for more information. + * + * @param string $name Textual name for this dataset. Must be [a-zA-Z0-9_], max length 19. + * @param string $type GAUGE | COUNTER | DERIVE | DCOUNTER | DDERIVE | ABSOLUTE. + * @param int $min Minimum allowed value. null means undefined. + * @param int $max Maximum allowed value. null means undefined. + * @param int $heartbeat Heartbeat for this dataset. Uses the global setting if null. + * @return $this + */ + public function addDataset($name, $type, $min = null, $max = null, $heartbeat = null) + { + global $config; + + $ds = array(); + $ds[] = $this->escapeName($name); + $ds[] = $this->checkType($type); + $ds[] = is_null($heartbeat) ? $config['rrd']['heartbeat'] : $heartbeat; + $ds[] = is_null($min) ? 'U' : $min; + $ds[] = is_null($max) ? 'U' : $max; + + $this->dataSets[] = $ds; + + return $this; + } + + /** + * Get the RRD Definition as it would be passed to rrdtool + * + * @return string + */ + public function __toString() + { + return array_reduce($this->dataSets, function ($carry, $ds) { + return $carry . 'DS:' . implode(':', $ds) . ' '; + }, ''); + } + + /** + * Check that the data set type is valid. + * + * @param string $type + * @return mixed + * @throws InvalidRrdTypeException + */ + private function checkType($type) + { + if (!in_array($type, self::$types)) { + $msg = "$type is not valid, must be: " . implode(' | ', self::$types); + throw new InvalidRrdTypeException($msg); + } + return $type; + } + + /** + * Remove all invalid characters from the name and truncate to 19 characters. + * + * @param string $name + * @return string + */ + private function escapeName($name) + { + $name = preg_replace('/[^a-zA-Z0-9_\-]/', '', $name); + return substr($name, 0, 19); + } +} diff --git a/doc/Support/1-Minute-Polling.md b/doc/Support/1-Minute-Polling.md new file mode 100644 index 0000000000..e79f5d7dfd --- /dev/null +++ b/doc/Support/1-Minute-Polling.md @@ -0,0 +1,15 @@ +source: Support/1-Minute-Polling.md + +We now have support for polling data at intervals to fit your needs. + +> Please be aware of the following: + + - You must also change your cron entry for `poller-wrapper.py` for this to work (if you change from the default 300 seconds). + - Your polling _MUST_ complete in the time you configure for the heartbeat step value. See `/pollers/tab=pollers/` in your WebUI for your current value. + - This will only affect RRD files created from the moment you change your settings. + - This change will affect all data storage mechanisms such as MySQL, RRD and InfluxDB. If you decreate the values then please be aware of the increase in space use for MySQL and InfluxDB. + +To make the changes, please navigate to `/settings/sub=external/` within your WebUI. Select RRDTool Setup and then update the two values for step and heartbeat intervals: + + - Step is how often you want to insert data, so if you change to 1 minute polling then this should be 60. + - Heartbeat is how long to wait for data before registering a null value, i.e 120 seconds. diff --git a/doc/Support/Configuration.md b/doc/Support/Configuration.md index ee6be241b1..f7b3a583af 100644 --- a/doc/Support/Configuration.md +++ b/doc/Support/Configuration.md @@ -20,7 +20,7 @@ $config['log_dir'] = "/opt/librenms/logs"; ``` Log files created by LibreNMS will be stored within this directory. -#### Database config +### Database config These are the configuration options you will need to use to specify to get started. @@ -32,15 +32,24 @@ $config['db_pass'] = ''; $config['db_name'] = ''; ``` -#### Programs +### Programs A lot of these are self explanatory so no further information may be provided. Any extensions that have dedicated documentation page will be linked to rather than having the config provided. +#### RRDTool + +> You can configure these options within the WebUI now, please avoid setting these options within config.php + +> Settings -> External Settings -> RRDTool Setup + ```php $config['rrdtool'] = "/usr/bin/rrdtool"; ``` +Please see [1 Minute polling]((1-Minute-Polling.md)) for information on configuring your install to record data more frequently. + +#### fping ```php $config['fping'] = "/usr/bin/fping"; $config['fping6'] = "fping6"; @@ -67,6 +76,8 @@ $config['icmp_check'] = false; If you would like to do this on a per device basis then you can do so under Device -> Edit -> Misc -> Disable ICMP Test? On +#### SNMP + ```php $config['snmpwalk'] = "/usr/bin/snmpwalk"; $config['snmpget'] = "/usr/bin/snmpget"; @@ -88,7 +99,7 @@ $config['neato'] = "/usr/bin/neato"; $config['sfdp'] = "/usr/bin/sfdp"; ``` -#### Proxy support +### Proxy support For alerting and the callback functionality, we support the use of a http proxy setting. These can be any one of the following: @@ -105,15 +116,15 @@ http_proxy=proxy.domain.com https_proxy=proxy.domain.com ``` -#### Memcached +### Memcached [Memcached](../Extensions/Memcached.md) -#### RRDCached +### RRDCached [RRDCached](../Extensions/RRDCached.md) -#### WebUI Settings +### WebUI Settings ```php $config['base_url'] = "http://demo.librenms.org"; @@ -237,7 +248,7 @@ You can enable the old style network map (only available for individual devices $config['gui']['network-map']['style'] = 'old'; ``` -#### Add host settings +### Add host settings The following setting controls how hosts are added. If a host is added as an ip address it is checked to ensure the ip is not already present. If the ip is present the host is not added. If host is added by hostname this check is not performed. If the setting is true hostnames are resolved and the check is also performed. This helps prevents accidental duplicate hosts. ```php @@ -251,7 +262,7 @@ By default we allow hosts to be added with duplicate sysName's, you can disable $config['allow_duplicate_sysName'] = false; ``` -#### SNMP Settings +### SNMP Settings ```php $config['snmp']['timeout'] = 1; # timeout in seconds @@ -277,11 +288,11 @@ $config['snmp']['v3'][0]['cryptoalgo'] = "AES"; # AES | DES ``` The default v3 snmp details to use, you can expand this array with `[1]`, `[2]`, `[3]`, etc. -#### Auto discovery settings +### Auto discovery settings [Auto-Discovery](../Extensions/Auto-Discovery.md) -#### Email configuration +### Email configuration > You can configure these options within the WebUI now, please avoid setting these options within config.php @@ -301,15 +312,15 @@ $config['email_smtp_password'] = NULL; What type of mail transport to use for delivering emails. Valid options for `email_backend` are mail, sendmail or smtp. The varying options after that are to support the different transports. -#### Alerting +### Alerting [Alerting](../Extensions/Alerting.md) -#### Billing +### Billing [Billing](../Extensions/Billing-Module.md) -#### Global module support +### Global module support ```php $config['enable_bgp'] = 1; # Enable BGP session collection and display @@ -320,7 +331,7 @@ $config['enable_vrfs'] = 1; # Enable VRFs $config['enable_sla'] = 0; # Enable Cisco SLA collection and display ``` -#### Port extensions +### Port extensions [Port-Description-Parser](../Extensions/Port-Description-Parser.md) @@ -364,7 +375,7 @@ Specify the location of the collectd unix socket. Using a socket allows the coll [NFSen](../Extensions/NFSen.md) -#### Location mapping +### Location mapping Exact Matching: ```php @@ -376,7 +387,7 @@ $config['location_map_regex']['/Sink/'] = "Under The Sink, The Office, London, U ``` The above are examples, these will rewrite device snmp locations so you don't need to configure full location within snmp. -#### Interfaces to be ignored +### Interfaces to be ignored Examples: @@ -398,7 +409,7 @@ by continuing the array. `bad_ifalias_regexp` is matched against the ifAlias value as a regular expression. -#### Interfaces to be rewritten +### Interfaces to be rewritten ```php $config['rewrite_if']['cpu'] = 'Management Interface'; @@ -408,7 +419,7 @@ Entries defined in `rewrite_if` are being replaced completely. Entries defined in `rewrite_if_regexp` only replace the match. Matches are compared case-insensitive. -#### Entity sensors to be ignored +### Entity sensors to be ignored Some devices register bogus sensors as they are returned via SNMP but either don't exist or just don't return data. This allows you to ignore those based on the descr field in the database. You can either ignore globally or on a per @@ -419,7 +430,7 @@ $config['bad_entity_sensor_regex'][] = '/Physical id [0-9]+/'; $config['os']['cisco']['bad_entity_sensor_regex'] = '/Physical id [0-9]+/'; ``` -#### Storage configuration +### Storage configuration ```php $config['ignore_mount_removable'] = 1; @@ -450,15 +461,15 @@ $config['ignore_mount_regexp'][] = "/UMA/"; ``` Mounted storage / mount points to ignore in discovery and polling. -#### IRC Bot +### IRC Bot [IRC Bot](../Extensions/IRC-Bot.md) -#### Authentication +### Authentication [Authentication](../Extensions/Authentication.md) -#### Cleanup options +### Cleanup options These options rely on daily.sh running from cron as per the installation instructions. @@ -476,11 +487,11 @@ values are in days. > NOTE: Please be aware that `$config['rrd_purge']` is _NOT_ set by default. This option will remove any old data within the rrd directory automatically - only enable this if you are comfortable with that happening. -#### Syslog options +### Syslog options [Syslog](../Extensions/Syslog.md) -#### Virtualization +### Virtualization ```php $config['enable_libvirt'] = 1; @@ -502,18 +513,18 @@ to indicate how you connect to libvirt. You also need to: To test your setup, run `virsh -c qemu+ssh://vmhost/system list` or `virsh -c xen+ssh://vmhost list` as your librenms polling user. -#### BGP Support +### BGP Support ```php -$config['astext'][65332] = "Cymru FullBogon Feed"; +$config['astext']['65332'] = "Cymru FullBogon Feed"; ``` You can use this array to rewrite the description of ASes that you have discovered. -#### Auto updates +### Auto updates [Updating](../General/Updating.md) -#### IPMI +### IPMI Setup the types of IPMI protocols to test a host for and it what order. ```php @@ -524,6 +535,6 @@ $config['ipmi']['type'][] = "imb"; $config['ipmi']['type'][] = "open"; ``` -#### Distributed poller settings +### Distributed poller settings [Distributed Poller](../Extensions/Distributed-Poller.md) diff --git a/html/pages/settings/external.inc.php b/html/pages/settings/external.inc.php index abcddd21a0..4574196f37 100644 --- a/html/pages/settings/external.inc.php +++ b/html/pages/settings/external.inc.php @@ -55,6 +55,15 @@ $rrdtool_conf = array( 'descr' => 'Tune all rrd port files to use max values', 'type' => 'checkbox', ), + array('name' => 'rrd.step', + 'descr' => 'Change the rrd step value (default 300)', + 'type' => 'text', + ), + array('name' => 'rrd.heartbeat', + 'descr' => 'Change the rrd heartbeat value (default 600)', + + 'type' => 'text', + ), ); echo ' diff --git a/includes/datastore.inc.php b/includes/datastore.inc.php index 718f80c1b5..9f4a5518b2 100644 --- a/includes/datastore.inc.php +++ b/includes/datastore.inc.php @@ -41,7 +41,7 @@ function rrd_array_filter($arr) * Datastore-independent function which should be used for all polled metrics. * * RRD Tags: - * rrd_def array|string: (required) an array of rrd field definitions example: "DS:dataName:COUNTER:600:U:100000000000" + * rrd_def RrdDefinition * rrd_name array|string: the rrd filename, will be processed with rrd_name() * rrd_oldname array|string: old rrd filename to rename, will be processed with rrd_name() * rrd_step int: rrd step, defaults to 300 diff --git a/includes/defaults.inc.php b/includes/defaults.inc.php index 7cb46a4779..fc0cb0d003 100644 --- a/includes/defaults.inc.php +++ b/includes/defaults.inc.php @@ -78,7 +78,8 @@ $config['rrd_rra'] = ' RRA:AVERAGE:0.5:1:2016 RRA:AVERAGE:0.5:6:1440 RRA:AVERAG $config['rrd_rra'] .= ' RRA:MIN:0.5:1:720 RRA:MIN:0.5:6:1440 RRA:MIN:0.5:24:775 RRA:MIN:0.5:288:797 '; $config['rrd_rra'] .= ' RRA:MAX:0.5:1:720 RRA:MAX:0.5:6:1440 RRA:MAX:0.5:24:775 RRA:MAX:0.5:288:797 '; $config['rrd_rra'] .= ' RRA:LAST:0.5:1:1440 '; - +$config['rrd']['heartbeat'] = 600; +$config['rrd']['step'] = 300; // RRDCacheD - Make sure it can write to your RRD dir! // $config['rrdcached'] = "unix:/var/run/rrdcached.sock"; diff --git a/includes/polling/applications/apache.inc.php b/includes/polling/applications/apache.inc.php index fdce7d6d20..1333d260cd 100644 --- a/includes/polling/applications/apache.inc.php +++ b/includes/polling/applications/apache.inc.php @@ -1,6 +1,8 @@ addDataset('access', 'DERIVE', 0, 125000000000) + ->addDataset('kbyte', 'DERIVE', 0, 125000000000) + ->addDataset('cpu', 'GAUGE', 0, 125000000000) + ->addDataset('uptime', 'GAUGE', 0, 125000000000) + ->addDataset('reqpersec', 'GAUGE', 0, 125000000000) + ->addDataset('bytespersec', 'GAUGE', 0, 125000000000) + ->addDataset('byesperreq', 'GAUGE', 0, 125000000000) + ->addDataset('busyworkers', 'GAUGE', 0, 125000000000) + ->addDataset('idleworkers', 'GAUGE', 0, 125000000000) + ->addDataset('sb_wait', 'GAUGE', 0, 125000000000) + ->addDataset('sb_start', 'GAUGE', 0, 125000000000) + ->addDataset('sb_reading', 'GAUGE', 0, 125000000000) + ->addDataset('sb_writing', 'GAUGE', 0, 125000000000) + ->addDataset('sb_keepalive', 'GAUGE', 0, 125000000000) + ->addDataset('sb_dns', 'GAUGE', 0, 125000000000) + ->addDataset('sb_closing', 'GAUGE', 0, 125000000000) + ->addDataset('sb_logging', 'GAUGE', 0, 125000000000) + ->addDataset('sb_graceful', 'GAUGE', 0, 125000000000) + ->addDataset('sb_idle', 'GAUGE', 0, 125000000000) + ->addDataset('sb_open', 'GAUGE', 0, 125000000000); $fields = array( 'access' => intval(trim($total_access, '"')), diff --git a/includes/polling/applications/bind.inc.php b/includes/polling/applications/bind.inc.php index a25b2a50ba..8aa7aefcc8 100644 --- a/includes/polling/applications/bind.inc.php +++ b/includes/polling/applications/bind.inc.php @@ -24,6 +24,8 @@ * @subpackage Polling */ +use LibreNMS\RRD\RrdDefinition; + $name = 'bind'; $app_id = $app['app_id']; if (!empty($agent_data['app'][$name]) && $app_id > 0) { @@ -69,18 +71,17 @@ if (!empty($agent_data['app'][$name]) && $app_id > 0) { }//end foreach $rrd_name = array('app', $name, $app_id); - $rrd_def = array( - 'DS:any:COUNTER:600:0:125000000000', - 'DS:a:COUNTER:600:0:125000000000', - 'DS:aaaa:COUNTER:600:0:125000000000', - 'DS:cname:COUNTER:600:0:125000000000', - 'DS:mx:COUNTER:600:0:125000000000', - 'DS:ns:COUNTER:600:0:125000000000', - 'DS:ptr:COUNTER:600:0:125000000000', - 'DS:soa:COUNTER:600:0:125000000000', - 'DS:srv:COUNTER:600:0:125000000000', - 'DS:spf:COUNTER:600:0:125000000000' - ); + $rrd_def = RrdDefinition::make() + ->addDataset('any', 'COUNTER', 0, 125000000000) + ->addDataset('a', 'COUNTER', 0, 125000000000) + ->addDataset('aaaa', 'COUNTER', 0, 125000000000) + ->addDataset('cname', 'COUNTER', 0, 125000000000) + ->addDataset('mx', 'COUNTER', 0, 125000000000) + ->addDataset('ns', 'COUNTER', 0, 125000000000) + ->addDataset('ptr', 'COUNTER', 0, 125000000000) + ->addDataset('soa', 'COUNTER', 0, 125000000000) + ->addDataset('srv', 'COUNTER', 0, 125000000000) + ->addDataset('spf', 'COUNTER', 0, 125000000000); $fields = array( 'any' => ((int)$bind_parsed['incoming_queries']['any']), diff --git a/includes/polling/applications/ceph.inc.php b/includes/polling/applications/ceph.inc.php index 96de49513e..20e717771d 100644 --- a/includes/polling/applications/ceph.inc.php +++ b/includes/polling/applications/ceph.inc.php @@ -1,5 +1,7 @@ ', $section); if ($section == "poolstats") { - $rrd_def = array( - 'DS:ops:GAUGE:600:0:U', - 'DS:wrbytes:GAUGE:600:0:U', - 'DS:rbytes:GAUGE:600:0:U' - ); + $rrd_def = RrdDefinition::make() + ->addDataset('ops', 'GAUGE', 0) + ->addDataset('wrbytes', 'GAUGE', 0) + ->addDataset('rbytes', 'GAUGE', 0); foreach (explode("\n", $data) as $line) { if (empty($line)) { @@ -34,10 +35,9 @@ if (!empty($agent_data['app'][$name])) { data_update($device, 'app', $tags, $fields); } } elseif ($section == "osdperformance") { - $rrd_def = array( - 'DS:apply_ms:GAUGE:600:0:U', - 'DS:commit_ms:GAUGE:600:0:U' - ); + $rrd_def = RrdDefinition::make() + ->addDataset('apply_ms', 'GAUGE', 0) + ->addDataset('commit_ms', 'GAUGE', 0); foreach (explode("\n", $data) as $line) { if (empty($line)) { @@ -55,11 +55,10 @@ if (!empty($agent_data['app'][$name])) { data_update($device, 'app', $tags, $fields); } } elseif ($section == "df") { - $rrd_def = array( - 'DS:avail:GAUGE:600:0:U', - 'DS:used:GAUGE:600:0:U', - 'DS:objects:GAUGE:600:0:U' - ); + $rrd_def = RrdDefinition::make() + ->addDataset('avail', 'GAUGE', 0) + ->addDataset('used', 'GAUGE', 0) + ->addDataset('objects', 'GAUGE', 0); foreach (explode("\n", $data) as $line) { if (empty($line)) { diff --git a/includes/polling/applications/dhcp-stats.inc.php b/includes/polling/applications/dhcp-stats.inc.php index d36a7508f7..4a7ed5d81b 100644 --- a/includes/polling/applications/dhcp-stats.inc.php +++ b/includes/polling/applications/dhcp-stats.inc.php @@ -1,4 +1,7 @@ addDataset('dhcp_total', 'GAUGE', 0) + ->addDataset('dhcp_active', 'GAUGE', 0) + ->addDataset('dhcp_expired', 'GAUGE', 0) + ->addDataset('dhcp_released', 'GAUGE', 0) + ->addDataset('dhcp_abandoned', 'GAUGE', 0) + ->addDataset('dhcp_reset', 'GAUGE', 0) + ->addDataset('dhcp_bootp', 'GAUGE', 0) + ->addDataset('dhcp_backup', 'GAUGE', 0) + ->addDataset('dhcp_free', 'GAUGE', 0); $fields = array( 'dhcp_total' => $dhcp_total, diff --git a/includes/polling/applications/drbd.inc.php b/includes/polling/applications/drbd.inc.php index ec86641878..dff50e0069 100644 --- a/includes/polling/applications/drbd.inc.php +++ b/includes/polling/applications/drbd.inc.php @@ -1,5 +1,6 @@ addDataset('ns', 'DERIVE', 0, 125000000000) + ->addDataset('nr', 'DERIVE', 0, 125000000000) + ->addDataset('dw', 'DERIVE', 0, 125000000000) + ->addDataset('dr', 'DERIVE', 0, 125000000000) + ->addDataset('al', 'DERIVE', 0, 125000000000) + ->addDataset('bm', 'DERIVE', 0, 125000000000) + ->addDataset('lo', 'GAUGE', 0, 125000000000) + ->addDataset('pe', 'GAUGE', 0, 125000000000) + ->addDataset('ua', 'GAUGE', 0, 125000000000) + ->addDataset('ap', 'GAUGE', 0, 125000000000) + ->addDataset('oos', 'GAUGE', 0, 125000000000); $fields = array( diff --git a/includes/polling/applications/exim-stats.inc.php b/includes/polling/applications/exim-stats.inc.php index 4102132208..c22b2438ee 100644 --- a/includes/polling/applications/exim-stats.inc.php +++ b/includes/polling/applications/exim-stats.inc.php @@ -19,6 +19,8 @@ * @author Cercel Valentin */ +use LibreNMS\RRD\RrdDefinition; + //NET-SNMP-EXTEND-MIB::nsExtendOutputFull."exim-stats" $name = 'exim-stats'; $app_id = $app['app_id']; @@ -30,10 +32,9 @@ echo ' '.$name; list ($frozen, $queue) = explode("\n", $stats); $rrd_name = array('app', $name, $app_id); -$rrd_def = array( - 'DS:frozen:GAUGE:600:0:U', - 'DS:queue:GAUGE:600:0:U' -); +$rrd_def = RrdDefinition::make() + ->addDataset('frozen', 'GAUGE', 0) + ->addDataset('queue', 'GAUGE', 0); $fields = array( 'frozen' => intval(trim($frozen, '"')), diff --git a/includes/polling/applications/freeswitch.inc.php b/includes/polling/applications/freeswitch.inc.php index 1fb19cb5c8..19c3fd39d1 100644 --- a/includes/polling/applications/freeswitch.inc.php +++ b/includes/polling/applications/freeswitch.inc.php @@ -1,4 +1,7 @@ addDataset('calls', 'GAUGE', 0, 10000) + ->addDataset('channels', 'GAUGE', 0, 10000) + ->addDataset('peak', 'GAUGE', 0, 10000) + ->addDataset('in_failed', 'COUNTER', 0, 4294967295) + ->addDataset('in_okay', 'COUNTER', 0, 4294967295) + ->addDataset('out_failed', 'COUNTER', 0, 4294967295) + ->addDataset('out_okay', 'COUNTER', 0, 4294967295); $fields = array ( 'calls' => $freeswitch['Calls'], 'channels' => $freeswitch['Channels'], diff --git a/includes/polling/applications/gpsd.inc.php b/includes/polling/applications/gpsd.inc.php index f10820d4c1..9b619b5efa 100644 --- a/includes/polling/applications/gpsd.inc.php +++ b/includes/polling/applications/gpsd.inc.php @@ -24,6 +24,8 @@ * @subpackage Polling */ +use LibreNMS\RRD\RrdDefinition; + $name = 'gpsd'; $app_id = $app['app_id']; if (!empty($agent_data['app'][$name]) && $app_id > 0) { @@ -37,13 +39,12 @@ if (!empty($agent_data['app'][$name]) && $app_id > 0) { } $rrd_name = array('app', $name, $app_id); - $rrd_def = array( - 'DS:mode:GAUGE:600:0:4', - 'DS:hdop:GAUGE:600:0:100', - 'DS:vdop:GAUGE:600:0:100', - 'DS:satellites:GAUGE:600:0:40', - 'DS:satellites_used:GAUGE:600:0:40', - ); + $rrd_def = RrdDefinition::make() + ->addDataset('mode', 'GAUGE', 0, 4) + ->addDataset('hdop', 'GAUGE', 0, 100) + ->addDataset('vdop', 'GAUGE', 0, 100) + ->addDataset('satellites', 'GAUGE', 0, 40) + ->addDataset('satellites_used', 'GAUGE', 0, 40); $check_fields = array( 'mode', diff --git a/includes/polling/applications/mailscanner.inc.php b/includes/polling/applications/mailscanner.inc.php index 601cfa7afd..19df78564b 100644 --- a/includes/polling/applications/mailscanner.inc.php +++ b/includes/polling/applications/mailscanner.inc.php @@ -2,6 +2,8 @@ // Polls MailScanner statistics from script via SNMP +use LibreNMS\RRD\RrdDefinition; + $options = '-O qv'; $oid = 'nsExtendOutputFull.11.109.97.105.108.115.99.97.110.110.101.114'; @@ -14,15 +16,14 @@ list ($msg_recv, $msg_rejected, $msg_relay, $msg_sent, $msg_waiting, $spam, $vir $name = 'mailscannerV2'; $app_id = $app['app_id']; $rrd_name = array('app', $name, $app_id); -$rrd_def = array( - 'DS:msg_recv:COUNTER:600:0:125000000000', - 'DS:msg_rejected:COUNTER:600:0:12500000000', - 'DS:msg_relay:COUNTER:600:0:125000000000', - 'DS:msg_sent:COUNTER:600:0:125000000000', - 'DS:msg_waiting:COUNTER:600:0:125000000000', - 'DS:spam:COUNTER:600:0:125000000000', - 'DS:virus:COUNTER:600:0:125000000000' -); +$rrd_def = RrdDefinition::make() + ->addDataset('msg_recv', 'COUNTER', 0, 125000000000) + ->addDataset('msg_rejected', 'COUNTER', 0, 12500000000) + ->addDataset('msg_relay', 'COUNTER', 0, 125000000000) + ->addDataset('msg_sent', 'COUNTER', 0, 125000000000) + ->addDataset('msg_waiting', 'COUNTER', 0, 125000000000) + ->addDataset('spam', 'COUNTER', 0, 125000000000) + ->addDataset('virus', 'COUNTER', 0, 125000000000); $fields = array( 'msg_recv' => $msg_recv, diff --git a/includes/polling/applications/memcached.inc.php b/includes/polling/applications/memcached.inc.php index 967e6acc85..53f91aa702 100644 --- a/includes/polling/applications/memcached.inc.php +++ b/includes/polling/applications/memcached.inc.php @@ -1,5 +1,7 @@ addDataset('uptime', 'GAUGE', 0, 125000000000) + ->addDataset('threads', 'GAUGE', 0, 125000000000) + ->addDataset('rusage_user_ms', 'DERIVE', 0, 125000000000) + ->addDataset('rusage_system_ms', 'DERIVE', 0, 125000000000) + ->addDataset('curr_items', 'GAUGE', 0, 125000000000) + ->addDataset('total_items', 'DERIVE', 0, 125000000000) + ->addDataset('limit_maxbytes', 'GAUGE', 0, 125000000000) + ->addDataset('curr_connections', 'GAUGE', 0, 125000000000) + ->addDataset('total_connections', 'DERIVE', 0, 125000000000) + ->addDataset('conn_structures', 'GAUGE', 0, 125000000000) + ->addDataset('bytes', 'GAUGE', 0, 125000000000) + ->addDataset('cmd_get', 'DERIVE', 0, 125000000000) + ->addDataset('cmd_set', 'DERIVE', 0, 125000000000) + ->addDataset('get_hits', 'DERIVE', 0, 125000000000) + ->addDataset('get_misses', 'DERIVE', 0, 125000000000) + ->addDataset('evictions', 'DERIVE', 0, 125000000000) + ->addDataset('bytes_read', 'DERIVE', 0, 125000000000) + ->addDataset('bytes_written', 'DERIVE', 0, 125000000000); $fields = array( 'uptime' => $data['uptime'], diff --git a/includes/polling/applications/mysql.inc.php b/includes/polling/applications/mysql.inc.php index 1d88b61fe6..77968d44d7 100644 --- a/includes/polling/applications/mysql.inc.php +++ b/includes/polling/applications/mysql.inc.php @@ -1,6 +1,8 @@ $v) { } $rrd_name = array('app', $name, $app_id); -$rrd_def = array( - 'DS:IDBLBSe:GAUGE:600:0:125000000000', - 'DS:IBLFh:DERIVE:600:0:125000000000', - 'DS:IBLWn:DERIVE:600:0:125000000000', - 'DS:SRows:DERIVE:600:0:125000000000', - 'DS:SRange:DERIVE:600:0:125000000000', - 'DS:SMPs:DERIVE:600:0:125000000000', - 'DS:SScan:DERIVE:600:0:125000000000', - 'DS:IBIRd:DERIVE:600:0:125000000000', - 'DS:IBIWr:DERIVE:600:0:125000000000', - 'DS:IBILg:DERIVE:600:0:125000000000', - 'DS:IBIFSc:DERIVE:600:0:125000000000', - 'DS:IDBRDd:DERIVE:600:0:125000000000', - 'DS:IDBRId:DERIVE:600:0:125000000000', - 'DS:IDBRRd:DERIVE:600:0:125000000000', - 'DS:IDBRUd:DERIVE:600:0:125000000000', - 'DS:IBRd:DERIVE:600:0:125000000000', - 'DS:IBCd:DERIVE:600:0:125000000000', - 'DS:IBWr:DERIVE:600:0:125000000000', - 'DS:TLIe:DERIVE:600:0:125000000000', - 'DS:TLWd:DERIVE:600:0:125000000000', - 'DS:IBPse:GAUGE:600:0:125000000000', - 'DS:IBPDBp:GAUGE:600:0:125000000000', - 'DS:IBPFe:GAUGE:600:0:125000000000', - 'DS:IBPMps:GAUGE:600:0:125000000000', - 'DS:TOC:GAUGE:600:0:125000000000', - 'DS:OFs:GAUGE:600:0:125000000000', - 'DS:OTs:GAUGE:600:0:125000000000', - 'DS:OdTs:COUNTER:600:0:125000000000', - 'DS:IBSRs:DERIVE:600:0:125000000000', - 'DS:IBSWs:DERIVE:600:0:125000000000', - 'DS:IBOWs:DERIVE:600:0:125000000000', - 'DS:QCs:GAUGE:600:0:125000000000', - 'DS:QCeFy:GAUGE:600:0:125000000000', - 'DS:MaCs:GAUGE:600:0:125000000000', - 'DS:MUCs:GAUGE:600:0:125000000000', - 'DS:ACs:DERIVE:600:0:125000000000', - 'DS:AdCs:DERIVE:600:0:125000000000', - 'DS:TCd:GAUGE:600:0:125000000000', - 'DS:Cs:DERIVE:600:0:125000000000', - 'DS:IBTNx:DERIVE:600:0:125000000000', - 'DS:KRRs:DERIVE:600:0:125000000000', - 'DS:KRs:DERIVE:600:0:125000000000', - 'DS:KWR:DERIVE:600:0:125000000000', - 'DS:KWs:DERIVE:600:0:125000000000', - 'DS:QCQICe:DERIVE:600:0:125000000000', - 'DS:QCHs:DERIVE:600:0:125000000000', - 'DS:QCIs:DERIVE:600:0:125000000000', - 'DS:QCNCd:DERIVE:600:0:125000000000', - 'DS:QCLMPs:DERIVE:600:0:125000000000', - 'DS:CTMPDTs:DERIVE:600:0:125000000000', - 'DS:CTMPTs:DERIVE:600:0:125000000000', - 'DS:CTMPFs:DERIVE:600:0:125000000000', - 'DS:IBIIs:DERIVE:600:0:125000000000', - 'DS:IBIMRd:DERIVE:600:0:125000000000', - 'DS:IBIMs:DERIVE:600:0:125000000000', - 'DS:IBILog:DERIVE:602:0:125000000000', - 'DS:IBISc:DERIVE:602:0:125000000000', - 'DS:IBIFLg:DERIVE:600:0:125000000000', - 'DS:IBFBl:DERIVE:600:0:125000000000', - 'DS:IBIIAo:DERIVE:600:0:125000000000', - 'DS:IBIAd:DERIVE:600:0:125000000000', - 'DS:IBIAe:DERIVE:600:0:125000000000', - 'DS:SFJn:DERIVE:600:0:125000000000', - 'DS:SFRJn:DERIVE:600:0:125000000000', - 'DS:SRe:DERIVE:600:0:125000000000', - 'DS:SRCk:DERIVE:600:0:125000000000', - 'DS:SSn:DERIVE:600:0:125000000000', - 'DS:SQs:DERIVE:600:0:125000000000', - 'DS:BRd:DERIVE:600:0:125000000000', - 'DS:BSt:DERIVE:600:0:125000000000', - 'DS:CDe:DERIVE:600:0:125000000000', - 'DS:CIt:DERIVE:600:0:125000000000', - 'DS:CISt:DERIVE:600:0:125000000000', - 'DS:CLd:DERIVE:600:0:125000000000', - 'DS:CRe:DERIVE:600:0:125000000000', - 'DS:CRSt:DERIVE:600:0:125000000000', - 'DS:CSt:DERIVE:600:0:125000000000', - 'DS:CUe:DERIVE:600:0:125000000000', - 'DS:CUMi:DERIVE:600:0:125000000000' -); +$rrd_def = RrdDefinition::make() + ->addDataset('IDBLBSe', 'GAUGE', 0, 125000000000) + ->addDataset('IBLFh', 'DERIVE', 0, 125000000000) + ->addDataset('IBLWn', 'DERIVE', 0, 125000000000) + ->addDataset('SRows', 'DERIVE', 0, 125000000000) + ->addDataset('SRange', 'DERIVE', 0, 125000000000) + ->addDataset('SMPs', 'DERIVE', 0, 125000000000) + ->addDataset('SScan', 'DERIVE', 0, 125000000000) + ->addDataset('IBIRd', 'DERIVE', 0, 125000000000) + ->addDataset('IBIWr', 'DERIVE', 0, 125000000000) + ->addDataset('IBILg', 'DERIVE', 0, 125000000000) + ->addDataset('IBIFSc', 'DERIVE', 0, 125000000000) + ->addDataset('IDBRDd', 'DERIVE', 0, 125000000000) + ->addDataset('IDBRId', 'DERIVE', 0, 125000000000) + ->addDataset('IDBRRd', 'DERIVE', 0, 125000000000) + ->addDataset('IDBRUd', 'DERIVE', 0, 125000000000) + ->addDataset('IBRd', 'DERIVE', 0, 125000000000) + ->addDataset('IBCd', 'DERIVE', 0, 125000000000) + ->addDataset('IBWr', 'DERIVE', 0, 125000000000) + ->addDataset('TLIe', 'DERIVE', 0, 125000000000) + ->addDataset('TLWd', 'DERIVE', 0, 125000000000) + ->addDataset('IBPse', 'GAUGE', 0, 125000000000) + ->addDataset('IBPDBp', 'GAUGE', 0, 125000000000) + ->addDataset('IBPFe', 'GAUGE', 0, 125000000000) + ->addDataset('IBPMps', 'GAUGE', 0, 125000000000) + ->addDataset('TOC', 'GAUGE', 0, 125000000000) + ->addDataset('OFs', 'GAUGE', 0, 125000000000) + ->addDataset('OTs', 'GAUGE', 0, 125000000000) + ->addDataset('OdTs', 'COUNTER', 0, 125000000000) + ->addDataset('IBSRs', 'DERIVE', 0, 125000000000) + ->addDataset('IBSWs', 'DERIVE', 0, 125000000000) + ->addDataset('IBOWs', 'DERIVE', 0, 125000000000) + ->addDataset('QCs', 'GAUGE', 0, 125000000000) + ->addDataset('QCeFy', 'GAUGE', 0, 125000000000) + ->addDataset('MaCs', 'GAUGE', 0, 125000000000) + ->addDataset('MUCs', 'GAUGE', 0, 125000000000) + ->addDataset('ACs', 'DERIVE', 0, 125000000000) + ->addDataset('AdCs', 'DERIVE', 0, 125000000000) + ->addDataset('TCd', 'GAUGE', 0, 125000000000) + ->addDataset('Cs', 'DERIVE', 0, 125000000000) + ->addDataset('IBTNx', 'DERIVE', 0, 125000000000) + ->addDataset('KRRs', 'DERIVE', 0, 125000000000) + ->addDataset('KRs', 'DERIVE', 0, 125000000000) + ->addDataset('KWR', 'DERIVE', 0, 125000000000) + ->addDataset('KWs', 'DERIVE', 0, 125000000000) + ->addDataset('QCQICe', 'DERIVE', 0, 125000000000) + ->addDataset('QCHs', 'DERIVE', 0, 125000000000) + ->addDataset('QCIs', 'DERIVE', 0, 125000000000) + ->addDataset('QCNCd', 'DERIVE', 0, 125000000000) + ->addDataset('QCLMPs', 'DERIVE', 0, 125000000000) + ->addDataset('CTMPDTs', 'DERIVE', 0, 125000000000) + ->addDataset('CTMPTs', 'DERIVE', 0, 125000000000) + ->addDataset('CTMPFs', 'DERIVE', 0, 125000000000) + ->addDataset('IBIIs', 'DERIVE', 0, 125000000000) + ->addDataset('IBIMRd', 'DERIVE', 0, 125000000000) + ->addDataset('IBIMs', 'DERIVE', 0, 125000000000) + ->addDataset('IBILog', 'DERIVE', 0, 125000000000) + ->addDataset('IBISc', 'DERIVE', 0, 125000000000) + ->addDataset('IBIFLg', 'DERIVE', 0, 125000000000) + ->addDataset('IBFBl', 'DERIVE', 0, 125000000000) + ->addDataset('IBIIAo', 'DERIVE', 0, 125000000000) + ->addDataset('IBIAd', 'DERIVE', 0, 125000000000) + ->addDataset('IBIAe', 'DERIVE', 0, 125000000000) + ->addDataset('SFJn', 'DERIVE', 0, 125000000000) + ->addDataset('SFRJn', 'DERIVE', 0, 125000000000) + ->addDataset('SRe', 'DERIVE', 0, 125000000000) + ->addDataset('SRCk', 'DERIVE', 0, 125000000000) + ->addDataset('SSn', 'DERIVE', 0, 125000000000) + ->addDataset('SQs', 'DERIVE', 0, 125000000000) + ->addDataset('BRd', 'DERIVE', 0, 125000000000) + ->addDataset('BSt', 'DERIVE', 0, 125000000000) + ->addDataset('CDe', 'DERIVE', 0, 125000000000) + ->addDataset('CIt', 'DERIVE', 0, 125000000000) + ->addDataset('CISt', 'DERIVE', 0, 125000000000) + ->addDataset('CLd', 'DERIVE', 0, 125000000000) + ->addDataset('CRe', 'DERIVE', 0, 125000000000) + ->addDataset('CRSt', 'DERIVE', 0, 125000000000) + ->addDataset('CSt', 'DERIVE', 0, 125000000000) + ->addDataset('CUe', 'DERIVE', 0, 125000000000) + ->addDataset('CUMi', 'DERIVE', 0, 125000000000); $tags = compact('name', 'app_id', 'rrd_name', 'rrd_def'); data_update($device, 'app', $tags, $fields); @@ -217,11 +218,12 @@ $mapping_status = array( ); $rrd_name = array('app', $name, $app_id, 'status'); -$rrd_def = array(); +$rrd_def = new RrdDefinition(); unset($fields); +$fields = array(); foreach ($mapping_status as $desc => $id) { $fields[$desc] = isset($map[$id]) ? $map[$id] : (-1); - $rrd_def[] = 'DS:'.$id.':GAUGE:600:0:125000000000'; + $rrd_def->addDataset($id, 'GAUGE', 0, 125000000000); } $status = true; $tags = compact('name', 'app_id', 'status', 'rrd_name', 'rrd_def'); diff --git a/includes/polling/applications/nfs-stats.inc.php b/includes/polling/applications/nfs-stats.inc.php index ad2a5d93e9..a1a8ea8189 100644 --- a/includes/polling/applications/nfs-stats.inc.php +++ b/includes/polling/applications/nfs-stats.inc.php @@ -1,4 +1,7 @@ addDataset('total', 'GAUGE', 0) + ->addDataset('null', 'GAUGE', 0) + ->addDataset('getattr', 'GAUGE', 0) + ->addDataset('setattr', 'GAUGE', 0) + ->addDataset('lookup', 'GAUGE', 0) + ->addDataset('access', 'GAUGE', 0) + ->addDataset('read', 'GAUGE', 0) + ->addDataset('write', 'GAUGE', 0) + ->addDataset('create', 'GAUGE', 0) + ->addDataset('mkdir', 'GAUGE', 0) + ->addDataset('remove', 'GAUGE', 0) + ->addDataset('rmdir', 'GAUGE', 0) + ->addDataset('rename', 'GAUGE', 0) + ->addDataset('readdirplus', 'GAUGE', 0) + ->addDataset('fsstat', 'GAUGE', 0); $data = explode("\n", $nfsstats); $fields = array( diff --git a/includes/polling/applications/nfs-v3-stats.inc.php b/includes/polling/applications/nfs-v3-stats.inc.php index 928cfad2d1..c4538a7a5e 100644 --- a/includes/polling/applications/nfs-v3-stats.inc.php +++ b/includes/polling/applications/nfs-v3-stats.inc.php @@ -1,4 +1,7 @@ addDataset('rc_hits', 'GAUGE', 0) + ->addDataset('rc_misses', 'GAUGE', 0) + ->addDataset('rc_nocache', 'GAUGE', 0) + ->addDataset('fh_lookup', 'GAUGE', 0) + ->addDataset('fh_anon', 'GAUGE', 0) + ->addDataset('fh_ncachedir', 'GAUGE', 0) + ->addDataset('fh_ncachenondir', 'GAUGE', 0) + ->addDataset('fh_stale', 'GAUGE', 0) + ->addDataset('io_read', 'GAUGE', 0) + ->addDataset('io_write', 'GAUGE', 0) + ->addDataset('ra_size', 'GAUGE', 0) + ->addDataset('ra_range01', 'GAUGE', 0) + ->addDataset('ra_range02', 'GAUGE', 0) + ->addDataset('ra_range03', 'GAUGE', 0) + ->addDataset('ra_range04', 'GAUGE', 0) + ->addDataset('ra_range05', 'GAUGE', 0) + ->addDataset('ra_range06', 'GAUGE', 0) + ->addDataset('ra_range07', 'GAUGE', 0) + ->addDataset('ra_range08', 'GAUGE', 0) + ->addDataset('ra_range09', 'GAUGE', 0) + ->addDataset('ra_range10', 'GAUGE', 0) + ->addDataset('ra_notfound', 'GAUGE', 0) + ->addDataset('net_all', 'GAUGE', 0) + ->addDataset('net_udp', 'GAUGE', 0) + ->addDataset('net_tcp', 'GAUGE', 0) + ->addDataset('net_tcpconn', 'GAUGE', 0) + ->addDataset('rpc_calls', 'GAUGE', 0) + ->addDataset('rpc_badcalls', 'GAUGE', 0) + ->addDataset('rpc_badfmt', 'GAUGE', 0) + ->addDataset('rpc_badauth', 'GAUGE', 0) + ->addDataset('rpc_badclnt', 'GAUGE', 0) + ->addDataset('proc3_null', 'GAUGE', 0) + ->addDataset('proc3_getattr', 'GAUGE', 0) + ->addDataset('proc3_setattr', 'GAUGE', 0) + ->addDataset('proc3_lookup', 'GAUGE', 0) + ->addDataset('proc3_access', 'GAUGE', 0) + ->addDataset('proc3_readlink', 'GAUGE', 0) + ->addDataset('proc3_read', 'GAUGE', 0) + ->addDataset('proc3_write', 'GAUGE', 0) + ->addDataset('proc3_create', 'GAUGE', 0) + ->addDataset('proc3_mkdir', 'GAUGE', 0) + ->addDataset('proc3_symlink', 'GAUGE', 0) + ->addDataset('proc3_mknod', 'GAUGE', 0) + ->addDataset('proc3_remove', 'GAUGE', 0) + ->addDataset('proc3_rmdir', 'GAUGE', 0) + ->addDataset('proc3_rename', 'GAUGE', 0) + ->addDataset('proc3_link', 'GAUGE', 0) + ->addDataset('proc3_readdir', 'GAUGE', 0) + ->addDataset('proc3_readdirplus', 'GAUGE', 0) + ->addDataset('proc3_fsstat', 'GAUGE', 0) + ->addDataset('proc3_fsinfo', 'GAUGE', 0) + ->addDataset('proc3_pathconf', 'GAUGE', 0) + ->addDataset('proc3_commit', 'GAUGE', 0); $data = explode("\n", $nfsstats); $fields = array( diff --git a/includes/polling/applications/nginx.inc.php b/includes/polling/applications/nginx.inc.php index 3e3f6f80b7..041bb077af 100644 --- a/includes/polling/applications/nginx.inc.php +++ b/includes/polling/applications/nginx.inc.php @@ -1,5 +1,7 @@ addDataset('Requests', 'DERIVE', 0, 125000000000) + ->addDataset('Active', 'GAUGE', 0, 125000000000) + ->addDataset('Reading', 'GAUGE', 0, 125000000000) + ->addDataset('Writing', 'GAUGE', 0, 125000000000) + ->addDataset('Waiting', 'GAUGE', 0, 125000000000); $fields = array( 'Requests' => $req, diff --git a/includes/polling/applications/ntp-client.inc.php b/includes/polling/applications/ntp-client.inc.php index 5186ba32fa..b45e180fc6 100644 --- a/includes/polling/applications/ntp-client.inc.php +++ b/includes/polling/applications/ntp-client.inc.php @@ -1,4 +1,7 @@ addDataset('offset', 'GAUGE', -1000, 1000) + ->addDataset('frequency', 'GAUGE', -1000, 1000) + ->addDataset('jitter', 'GAUGE', -1000, 1000) + ->addDataset('noise', 'GAUGE', -1000, 1000) + ->addDataset('stability', 'GAUGE', -1000, 1000); $fields = array( 'offset' => $offset, diff --git a/includes/polling/applications/ntp-server.inc.php b/includes/polling/applications/ntp-server.inc.php index 5bfbb585b4..3ac1994aee 100644 --- a/includes/polling/applications/ntp-server.inc.php +++ b/includes/polling/applications/ntp-server.inc.php @@ -1,4 +1,7 @@ addDataset('stratum', 'GAUGE', 0, 1000) + ->addDataset('offset', 'GAUGE', -1000, 1000) + ->addDataset('frequency', 'GAUGE', -1000, 1000) + ->addDataset('jitter', 'GAUGE', -1000, 1000) + ->addDataset('noise', 'GAUGE', -1000, 1000) + ->addDataset('stability', 'GAUGE', -1000, 1000) + ->addDataset('uptime', 'GAUGE', 0, 125000000000) + ->addDataset('buffer_recv', 'GAUGE', 0, 100000) + ->addDataset('buffer_free', 'GAUGE', 0, 100000) + ->addDataset('buffer_used', 'GAUGE', 0, 100000) + ->addDataset('packets_drop', 'DERIVE', 0, 125000000000) + ->addDataset('packets_ignore', 'DERIVE', 0, 125000000000) + ->addDataset('packets_recv', 'DERIVE', 0, 125000000000) + ->addDataset('packets_sent', 'DERIVE', 0, 125000000000); $fields = array( diff --git a/includes/polling/applications/os-updates.inc.php b/includes/polling/applications/os-updates.inc.php index ddc5d27b43..ce2fc2f8c1 100644 --- a/includes/polling/applications/os-updates.inc.php +++ b/includes/polling/applications/os-updates.inc.php @@ -1,4 +1,6 @@ addDataset('packages', 'GAUGE', 0); $osupdates = snmp_get($device, $oid, $options, $mib); diff --git a/includes/polling/applications/php-fpm.inc.php b/includes/polling/applications/php-fpm.inc.php index 2065ba412a..473b3fe35a 100644 --- a/includes/polling/applications/php-fpm.inc.php +++ b/includes/polling/applications/php-fpm.inc.php @@ -1,4 +1,7 @@ addDataset('lq', 'GAUGE', 0) + ->addDataset('mlq', 'GAUGE', 0) + ->addDataset('ip', 'GAUGE', 0) + ->addDataset('ap', 'GAUGE', 0) + ->addDataset('tp', 'GAUGE', 0) + ->addDataset('map', 'GAUGE', 0) + ->addDataset('mcr', 'GAUGE', 0) + ->addDataset('sr', 'GAUGE', 0); $fields = array( 'lq' => $listen_queue, diff --git a/includes/polling/applications/powerdns-recursor.inc.php b/includes/polling/applications/powerdns-recursor.inc.php index 41e3acf6a7..44cf4134af 100644 --- a/includes/polling/applications/powerdns-recursor.inc.php +++ b/includes/polling/applications/powerdns-recursor.inc.php @@ -24,6 +24,8 @@ * @author Tony Murray */ +use LibreNMS\RRD\RrdDefinition; + global $config; $data = ''; $name = 'powerdns-recursor'; @@ -48,65 +50,65 @@ if ($agent_data['app'][$name]) { } if (!empty($data)) { - $rrd_def = array( - 'all-outqueries' => 'DS:all-outqueries:DERIVE:600:0:U', - 'answers-slow' => 'DS:answers-slow:DERIVE:600:0:U', - 'answers0-1' => 'DS:answers0-1:DERIVE:600:0:U', - 'answers1-10' => 'DS:answers1-10:DERIVE:600:0:U', - 'answers10-100' => 'DS:answers10-100:DERIVE:600:0:U', - 'answers100-1000' => 'DS:answers100-1000:DERIVE:600:0:U', - 'cache-entries' => 'DS:cache-entries:GAUGE:600:0:U', - 'cache-hits' => 'DS:cache-hits:DERIVE:600:0:U', - 'cache-misses' => 'DS:cache-misses:DERIVE:600:0:U', - 'case-mismatches' => 'DS:case-mismatches:DERIVE:600:0:U', - 'chain-resends' => 'DS:chain-resends:DERIVE:600:0:U', - 'client-parse-errors' => 'DS:client-parse-errors:DERIVE:600:0:U', - 'concurrent-queries' => 'DS:concurrent-queries:GAUGE:600:0:U', - 'dlg-only-drops' => 'DS:dlg-only-drops:DERIVE:600:0:U', - 'dont-outqueries' => 'DS:dont-outqueries:DERIVE:600:0:U', - 'edns-ping-matches' => 'DS:edns-ping-matches:DERIVE:600:0:U', - 'edns-ping-mismatches' => 'DS:edns-ping-mismatche:DERIVE:600:0:U', - 'failed-host-entries' => 'DS:failed-host-entries:GAUGE:600:0:U', - 'ipv6-outqueries' => 'DS:ipv6-outqueries:DERIVE:600:0:U', - 'ipv6-questions' => 'DS:ipv6-questions:DERIVE:600:0:U', - 'malloc-bytes' => 'DS:malloc-bytes:GAUGE:600:0:U', - 'max-mthread-stack' => 'DS:max-mthread-stack:GAUGE:600:0:U', - 'negcache-entries' => 'DS:negcache-entries:GAUGE:600:0:U', - 'no-packet-error' => 'DS:no-packet-error:DERIVE:600:0:U', - 'noedns-outqueries' => 'DS:noedns-outqueries:DERIVE:600:0:U', - 'noerror-answers' => 'DS:noerror-answers:DERIVE:600:0:U', - 'noping-outqueries' => 'DS:noping-outqueries:DERIVE:600:0:U', - 'nsset-invalidations' => 'DS:nsset-invalidations:DERIVE:600:0:U', - 'nsspeeds-entries' => 'DS:nsspeeds-entries:GAUGE:600:0:U', - 'nxdomain-answers' => 'DS:nxdomain-answers:DERIVE:600:0:U', - 'outgoing-timeouts' => 'DS:outgoing-timeouts:DERIVE:600:0:U', - 'over-capacity-drops' => 'DS:over-capacity-drops:DERIVE:600:0:U', - 'packetcache-entries' => 'DS:packetcache-entries:GAUGE:600:0:U', - 'packetcache-hits' => 'DS:packetcache-hits:DERIVE:600:0:U', - 'packetcache-misses' => 'DS:packetcache-misses:DERIVE:600:0:U', - 'policy-drops' => 'DS:policy-drops:DERIVE:600:0:U', - 'qa-latency' => 'DS:qa-latency:GAUGE:600:0:U', - 'questions' => 'DS:questions:DERIVE:600:0:U', - 'resource-limits' => 'DS:resource-limits:DERIVE:600:0:U', - 'security-status' => 'DS:security-status:GAUGE:600:0:U', - 'server-parse-errors' => 'DS:server-parse-errors:DERIVE:600:0:U', - 'servfail-answers' => 'DS:servfail-answers:DERIVE:600:0:U', - 'spoof-prevents' => 'DS:spoof-prevents:DERIVE:600:0:U', - 'sys-msec' => 'DS:sys-msec:DERIVE:600:0:U', - 'tcp-client-overflow' => 'DS:tcp-client-overflow:DERIVE:600:0:U', - 'tcp-clients' => 'DS:tcp-clients:GAUGE:600:0:U', - 'tcp-outqueries' => 'DS:tcp-outqueries:DERIVE:600:0:U', - 'tcp-questions' => 'DS:tcp-questions:DERIVE:600:0:U', - 'throttle-entries' => 'DS:throttle-entries:GAUGE:600:0:U', - 'throttled-out' => 'DS:throttled-out:DERIVE:600:0:U', - 'throttled-outqueries' => 'DS:throttled-outquerie:DERIVE:600:0:U', - 'too-old-drops' => 'DS:too-old-drops:DERIVE:600:0:U', - 'unauthorized-tcp' => 'DS:unauthorized-tcp:DERIVE:600:0:U', - 'unauthorized-udp' => 'DS:unauthorized-udp:DERIVE:600:0:U', - 'unexpected-packets' => 'DS:unexpected-packets:DERIVE:600:0:U', - 'unreachables' => 'DS:unreachables:DERIVE:600:0:U', - 'uptime' => 'DS:uptime:DERIVE:600:0:U', - 'user-msec' => 'DS:user-msec:DERIVE:600:0:U', + $ds_list = array( + 'all-outqueries' => 'DERIVE', + 'answers-slow' => 'DERIVE', + 'answers0-1' => 'DERIVE', + 'answers1-10' => 'DERIVE', + 'answers10-100' => 'DERIVE', + 'answers100-1000' => 'DERIVE', + 'cache-entries' => 'GAUGE', + 'cache-hits' => 'DERIVE', + 'cache-misses' => 'DERIVE', + 'case-mismatches' => 'DERIVE', + 'chain-resends' => 'DERIVE', + 'client-parse-errors' => 'DERIVE', + 'concurrent-queries' => 'GAUGE', + 'dlg-only-drops' => 'DERIVE', + 'dont-outqueries' => 'DERIVE', + 'edns-ping-matches' => 'DERIVE', + 'edns-ping-mismatches' => 'DERIVE', + 'failed-host-entries' => 'GAUGE', + 'ipv6-outqueries' => 'DERIVE', + 'ipv6-questions' => 'DERIVE', + 'malloc-bytes' => 'GAUGE', + 'max-mthread-stack' => 'GAUGE', + 'negcache-entries' => 'GAUGE', + 'no-packet-error' => 'DERIVE', + 'noedns-outqueries' => 'DERIVE', + 'noerror-answers' => 'DERIVE', + 'noping-outqueries' => 'DERIVE', + 'nsset-invalidations' => 'DERIVE', + 'nsspeeds-entries' => 'GAUGE', + 'nxdomain-answers' => 'DERIVE', + 'outgoing-timeouts' => 'DERIVE', + 'over-capacity-drops' => 'DERIVE', + 'packetcache-entries' => 'GAUGE', + 'packetcache-hits' => 'DERIVE', + 'packetcache-misses' => 'DERIVE', + 'policy-drops' => 'DERIVE', + 'qa-latency' => 'GAUGE', + 'questions' => 'DERIVE', + 'resource-limits' => 'DERIVE', + 'security-status' => 'GAUGE', + 'server-parse-errors' => 'DERIVE', + 'servfail-answers' => 'DERIVE', + 'spoof-prevents' => 'DERIVE', + 'sys-msec' => 'DERIVE', + 'tcp-client-overflow' => 'DERIVE', + 'tcp-clients' => 'GAUGE', + 'tcp-outqueries' => 'DERIVE', + 'tcp-questions' => 'DERIVE', + 'throttle-entries' => 'GAUGE', + 'throttled-out' => 'DERIVE', + 'throttled-outqueries' => 'DERIVE', + 'too-old-drops' => 'DERIVE', + 'unauthorized-tcp' => 'DERIVE', + 'unauthorized-udp' => 'DERIVE', + 'unexpected-packets' => 'DERIVE', + 'unreachables' => 'DERIVE', + 'uptime' => 'DERIVE', + 'user-msec' => 'DERIVE', ); //decode and flatten the data @@ -117,8 +119,11 @@ if (!empty($data)) { d_echo($stats); // only the stats we store in rrd + $rrd_def = new RrdDefinition(); $fields = array(); - foreach ($rrd_def as $key => $value) { + foreach ($ds_list as $key => $type) { + $rrd_def->addDataset($key, $type, 0); + if (isset($stats[$key])) { $fields[$key] = $stats[$key]; } else { diff --git a/includes/polling/applications/powerdns.inc.php b/includes/polling/applications/powerdns.inc.php index de0d2ae13f..99470f1c4c 100644 --- a/includes/polling/applications/powerdns.inc.php +++ b/includes/polling/applications/powerdns.inc.php @@ -1,6 +1,9 @@ addDataset('corruptPackets', 'DERIVE', 0, 125000000000) + ->addDataset('def_cacheInserts', 'DERIVE', 0, 125000000000) + ->addDataset('def_cacheLookup', 'DERIVE', 0, 125000000000) + ->addDataset('latency', 'DERIVE', 0, 125000000000) + ->addDataset('pc_hit', 'DERIVE', 0, 125000000000) + ->addDataset('pc_miss', 'DERIVE', 0, 125000000000) + ->addDataset('pc_size', 'DERIVE', 0, 125000000000) + ->addDataset('qsize', 'DERIVE', 0, 125000000000) + ->addDataset('qc_hit', 'DERIVE', 0, 125000000000) + ->addDataset('qc_miss', 'DERIVE', 0, 125000000000) + ->addDataset('rec_answers', 'DERIVE', 0, 125000000000) + ->addDataset('rec_questions', 'DERIVE', 0, 125000000000) + ->addDataset('servfailPackets', 'DERIVE', 0, 125000000000) + ->addDataset('q_tcpAnswers', 'DERIVE', 0, 125000000000) + ->addDataset('q_tcpQueries', 'DERIVE', 0, 125000000000) + ->addDataset('q_timedout', 'DERIVE', 0, 125000000000) + ->addDataset('q_udpAnswers', 'DERIVE', 0, 125000000000) + ->addDataset('q_udpQueries', 'DERIVE', 0, 125000000000) + ->addDataset('q_udp4Answers', 'DERIVE', 0, 125000000000) + ->addDataset('q_udp4Queries', 'DERIVE', 0, 125000000000) + ->addDataset('q_udp6Answers', 'DERIVE', 0, 125000000000) + ->addDataset('q_udp6Queries', 'DERIVE', 0, 125000000000); $fields = array( 'corruptPackets' => $corrupt, diff --git a/includes/polling/applications/proxmox.inc.php b/includes/polling/applications/proxmox.inc.php index 2226b316a7..8132bf7201 100644 --- a/includes/polling/applications/proxmox.inc.php +++ b/includes/polling/applications/proxmox.inc.php @@ -1,5 +1,7 @@ $vmid, 'vmport' => $vmport ); - $rrd_def = array( - 'DS:INOCTETS:DERIVE:600:0:12500000000', - 'DS:OUTOCTETS:DERIVE:600:0:12500000000' - ); + $rrd_def = RrdDefinition::make() + ->addDataset('INOCTETS', 'DERIVE', 0, 12500000000) + ->addDataset('OUTOCTETS', 'DERIVE', 0, 12500000000); $fields = array( 'INOCTETS' => $vmpin, 'OUTOCTETS' => $vmpout diff --git a/includes/polling/applications/rrdcached.inc.php b/includes/polling/applications/rrdcached.inc.php index c727c93780..7229dffb5c 100644 --- a/includes/polling/applications/rrdcached.inc.php +++ b/includes/polling/applications/rrdcached.inc.php @@ -25,6 +25,8 @@ * @author Tony Murray */ +use LibreNMS\RRD\RrdDefinition; + echo ' rrdcached'; $data = ""; @@ -70,17 +72,16 @@ if ($agent_data['app'][$name]) { $rrd_name = array('app', $name, $app_id); -$rrd_def = array( - 'DS:queue_length:GAUGE:600:0:U', - 'DS:updates_received:COUNTER:600:0:U', - 'DS:flushes_received:COUNTER:600:0:U', - 'DS:updates_written:COUNTER:600:0:U', - 'DS:data_sets_written:COUNTER:600:0:U', - 'DS:tree_nodes_number:GAUGE:600:0:U', - 'DS:tree_depth:GAUGE:600:0:U', - 'DS:journal_bytes:COUNTER:600:0:U', - 'DS:journal_rotate:COUNTER:600:0:U' -); +$rrd_def = RrdDefinition::make() + ->addDataset('queue_length', 'GAUGE', 0) + ->addDataset('updates_received', 'COUNTER', 0) + ->addDataset('flushes_received', 'COUNTER', 0) + ->addDataset('updates_written', 'COUNTER', 0) + ->addDataset('data_sets_written', 'COUNTER', 0) + ->addDataset('tree_nodes_number', 'GAUGE', 0) + ->addDataset('tree_depth', 'GAUGE', 0) + ->addDataset('journal_bytes', 'COUNTER', 0) + ->addDataset('journal_rotate', 'COUNTER', 0); $fields = array(); foreach (explode("\n", $data) as $line) { diff --git a/includes/polling/applications/shoutcast.inc.php b/includes/polling/applications/shoutcast.inc.php index f5a9c0cc54..164ee27d76 100644 --- a/includes/polling/applications/shoutcast.inc.php +++ b/includes/polling/applications/shoutcast.inc.php @@ -1,6 +1,9 @@ $server) { list($host, $port) = explode(':', $data['0'], 2); $rrd_name = array('app', $name, $app_id, $host . '_' . $port); - $rrd_def = array( - 'DS:bitrate:GAUGE:600:0:125000000000', - 'DS:traf_in:GAUGE:600:0:125000000000', - 'DS:traf_out:GAUGE:600:0:125000000000', - 'DS:current:GAUGE:600:0:125000000000', - 'DS:status:GAUGE:600:0:125000000000', - 'DS:peak:GAUGE:600:0:125000000000', - 'DS:max:GAUGE:600:0:125000000000', - 'DS:unique:GAUGE:600:0:125000000000' - ); + $rrd_def = RrdDefinition::make() + ->addDataset('bitrate', 'GAUGE', 0, 125000000000) + ->addDataset('traf_in', 'GAUGE', 0, 125000000000) + ->addDataset('traf_out', 'GAUGE', 0, 125000000000) + ->addDataset('current', 'GAUGE', 0, 125000000000) + ->addDataset('status', 'GAUGE', 0, 125000000000) + ->addDataset('peak', 'GAUGE', 0, 125000000000) + ->addDataset('max', 'GAUGE', 0, 125000000000) + ->addDataset('unique', 'GAUGE', 0, 125000000000); $fields = array( 'bitrate' => $data['1'], diff --git a/includes/polling/applications/tinydns.inc.php b/includes/polling/applications/tinydns.inc.php index 8750e63c36..cfc23d0d0a 100644 --- a/includes/polling/applications/tinydns.inc.php +++ b/includes/polling/applications/tinydns.inc.php @@ -24,33 +24,34 @@ * @subpackage Polling */ +use LibreNMS\RRD\RrdDefinition; + $name = 'tinydns'; $app_id = $app['app_id']; if (!empty($agent_data['app'][$name]) && $app_id > 0) { echo ' tinydns'; $rrd_name = array('app', $name, $app_id); - $rrd_def = array( - 'DS:a:COUNTER:600:0:125000000000', - 'DS:ns:COUNTER:600:0:125000000000', - 'DS:cname:COUNTER:600:0:125000000000', - 'DS:soa:COUNTER:600:0:125000000000', - 'DS:ptr:COUNTER:600:0:125000000000', - 'DS:hinfo:COUNTER:600:0:125000000000', - 'DS:mx:COUNTER:600:0:125000000000', - 'DS:txt:COUNTER:600:0:125000000000', - 'DS:rp:COUNTER:600:0:125000000000', - 'DS:sig:COUNTER:600:0:125000000000', - 'DS:key:COUNTER:600:0:125000000000', - 'DS:aaaa:COUNTER:600:0:125000000000', - 'DS:axfr:COUNTER:600:0:125000000000', - 'DS:any:COUNTER:600:0:125000000000', - 'DS:total:COUNTER:600:0:125000000000', - 'DS:other:COUNTER:600:0:125000000000', - 'DS:notauth:COUNTER:600:0:125000000000', - 'DS:notimpl:COUNTER:600:0:125000000000', - 'DS:badclass:COUNTER:600:0:125000000000', - 'DS:noquery:COUNTER:600:0:125000000000' - ); + $rrd_def = RrdDefinition::make() + ->addDataset('a', 'COUNTER', 0, 125000000000) + ->addDataset('ns', 'COUNTER', 0, 125000000000) + ->addDataset('cname', 'COUNTER', 0, 125000000000) + ->addDataset('soa', 'COUNTER', 0, 125000000000) + ->addDataset('ptr', 'COUNTER', 0, 125000000000) + ->addDataset('hinfo', 'COUNTER', 0, 125000000000) + ->addDataset('mx', 'COUNTER', 0, 125000000000) + ->addDataset('txt', 'COUNTER', 0, 125000000000) + ->addDataset('rp', 'COUNTER', 0, 125000000000) + ->addDataset('sig', 'COUNTER', 0, 125000000000) + ->addDataset('key', 'COUNTER', 0, 125000000000) + ->addDataset('aaaa', 'COUNTER', 0, 125000000000) + ->addDataset('axfr', 'COUNTER', 0, 125000000000) + ->addDataset('any', 'COUNTER', 0, 125000000000) + ->addDataset('total', 'COUNTER', 0, 125000000000) + ->addDataset('other', 'COUNTER', 0, 125000000000) + ->addDataset('notauth', 'COUNTER', 0, 125000000000) + ->addDataset('notimpl', 'COUNTER', 0, 125000000000) + ->addDataset('badclass', 'COUNTER', 0, 125000000000) + ->addDataset('noquery', 'COUNTER', 0, 125000000000); $tags = compact('name', 'app_id', 'rrd_name', 'rrd_def'); data_update($device, 'app', $tags, $fields); diff --git a/includes/polling/applications/unbound.inc.php b/includes/polling/applications/unbound.inc.php index d142d90fd5..a00f1365a0 100644 --- a/includes/polling/applications/unbound.inc.php +++ b/includes/polling/applications/unbound.inc.php @@ -1,4 +1,7 @@ addDataset('type0', 'DERIVE', 0, 125000000000) + ->addDataset('A', 'DERIVE', 0, 125000000000) + ->addDataset('NS', 'DERIVE', 0, 125000000000) + ->addDataset('CNAME', 'DERIVE', 0, 125000000000) + ->addDataset('SOA', 'DERIVE', 0, 125000000000) + ->addDataset('NULL', 'DERIVE', 0, 125000000000) + ->addDataset('WKS', 'DERIVE', 0, 125000000000) + ->addDataset('PTR', 'DERIVE', 0, 125000000000) + ->addDataset('MX', 'DERIVE', 0, 125000000000) + ->addDataset('TXT', 'DERIVE', 0, 125000000000) + ->addDataset('AAAA', 'DERIVE', 0, 125000000000) + ->addDataset('SRV', 'DERIVE', 0, 125000000000) + ->addDataset('NAPTR', 'DERIVE', 0, 125000000000) + ->addDataset('DS', 'DERIVE', 0, 125000000000) + ->addDataset('DNSKEY', 'DERIVE', 0, 125000000000) + ->addDataset('SPF', 'DERIVE', 0, 125000000000) + ->addDataset('ANY', 'DERIVE', 0, 125000000000) + ->addDataset('other', 'DERIVE', 0, 125000000000); $fields = array ( 'type0' => $unbound['num.query.type.TYPE0'], 'a' => $unbound['num.query.type.A'], diff --git a/includes/polling/applications/ups-apcups.inc.php b/includes/polling/applications/ups-apcups.inc.php index b2110c7b0a..8fe6123fde 100644 --- a/includes/polling/applications/ups-apcups.inc.php +++ b/includes/polling/applications/ups-apcups.inc.php @@ -19,6 +19,8 @@ * @author Cercel Valentin */ +use LibreNMS\RRD\RrdDefinition; + //NET-SNMP-EXTEND-MIB::nsExtendOutputFull."ups-apcups" $name = 'ups-apcups'; $app_id = $app['app_id']; @@ -30,15 +32,14 @@ echo ' '.$name; list ($line_volt, $load, $charge, $remaining, $bat_volt, $line_nominal, $bat_nominal) = explode("\n", $ups_apcups); $rrd_name = array('app', $name, $app_id); -$rrd_def = array( - 'DS:charge:GAUGE:600:0:100', - 'DS:time_remaining:GAUGE:600:0:U', - 'DS:battery_nominal:GAUGE:600:0:U', - 'DS:battery_voltage:GAUGE:600:0:U', - 'DS:input_voltage:GAUGE:600:0:U', - 'DS:nominal_voltage:GAUGE:600:0:U', - 'DS:load:GAUGE:600:0:100' -); +$rrd_def = RrdDefinition::make() + ->addDataset('charge', 'GAUGE', 0, 100) + ->addDataset('time_remaining', 'GAUGE', 0) + ->addDataset('battery_nominal', 'GAUGE', 0) + ->addDataset('battery_voltage', 'GAUGE', 0) + ->addDataset('input_voltage', 'GAUGE', 0) + ->addDataset('nominal_voltage', 'GAUGE', 0) + ->addDataset('load', 'GAUGE', 0, 100); $fields = array( 'charge' => $charge, diff --git a/includes/polling/applications/ups-nut.inc.php b/includes/polling/applications/ups-nut.inc.php index b3969d1b65..65482516c9 100644 --- a/includes/polling/applications/ups-nut.inc.php +++ b/includes/polling/applications/ups-nut.inc.php @@ -20,6 +20,8 @@ * */ +use LibreNMS\RRD\RrdDefinition; + // (2016-11-25, R.Morris) ups-nut, try "extend" -> if not, fall back to "exec" support. // -> Similar to approach used by Distro, but skip "legacy UCD-MIB shell support" // @@ -44,17 +46,15 @@ echo ' '.$name; list ($charge, $battery_low, $remaining, $bat_volt, $bat_nom, $line_nom, $input_volt, $load) = explode("\n", $ups_nut); $rrd_name = array('app', $name, $app_id); -$rrd_def = array( - 'DS:charge:GAUGE:600:0:100', - 'DS:battery_low:GAUGE:600:0:100', - 'DS:time_remaining:GAUGE:600:0:U', - 'DS:battery_voltage:GAUGE:600:0:U', - 'DS:battery_nominal:GAUGE:600:0:U', - 'DS:line_nominal:GAUGE:600:0:U', - 'DS:input_voltage:GAUGE:600:0:U', - 'DS:load:GAUGE:600:0:100' -); -//print_r(array_values($rrd_def)); +$rrd_def = RrdDefinition::make() + ->addDataset('charge', 'GAUGE', 0, 100) + ->addDataset('battery_low', 'GAUGE', 0, 100) + ->addDataset('time_remaining', 'GAUGE', 0) + ->addDataset('battery_voltage', 'GAUGE', 0) + ->addDataset('battery_nominal', 'GAUGE', 0) + ->addDataset('line_nominal', 'GAUGE', 0) + ->addDataset('input_voltage', 'GAUGE', 0) + ->addDataset('load', 'GAUGE', 0, 100); $fields = array( 'charge' => $charge, @@ -66,7 +66,6 @@ $fields = array( 'input_voltage' => $input_volt, 'load' => $load ); -//print_r(array_values($fields)); $tags = compact('name', 'app_id', 'rrd_name', 'rrd_def'); data_update($device, 'app', $tags, $fields); diff --git a/includes/polling/aruba-controller.inc.php b/includes/polling/aruba-controller.inc.php index 74efc62824..3d408001e6 100644 --- a/includes/polling/aruba-controller.inc.php +++ b/includes/polling/aruba-controller.inc.php @@ -1,4 +1,7 @@ addDataset('NUMAPS', 'GAUGE', 0, 12500000000) + ->addDataset('NUMCLIENTS', 'GAUGE', 0, 12500000000); $fields = array( 'NUMAPS' => $aruba_stats[0]['wlsxSwitchTotalNumAccessPoints'], @@ -64,7 +66,7 @@ if ($device['type'] == 'wireless' && $device['os'] == 'arubaos') { // also save the info about how many clients in the same place as the wireless module $rrd_name = 'wificlients-radio1'; - $rrd_def = 'S:wificlients:GAUGE:600:-273:10000'; + $rrd_def = 'S:wificlients:GAUGE:'.$config['rrd']['heartbeat'].':-273:10000'; $fields = array( 'wificlients' => $aruba_stats[0]['wlsxSwitchTotalNumStationsAssociated'], @@ -114,15 +116,14 @@ if ($device['type'] == 'wireless' && $device['os'] == 'arubaos') { if (is_numeric($channel)) { $rrd_name = array('arubaap', $name.$radionum); - $rrd_def = array( - 'DS:channel:GAUGE:600:0:200', - 'DS:txpow:GAUGE:600:0:200', - 'DS:radioutil:GAUGE:600:0:100', - 'DS:nummonclients:GAUGE:600:0:500', - 'DS:nummonbssid:GAUGE:600:0:200', - 'DS:numasoclients:GAUGE:600:0:500', - 'DS:interference:GAUGE:600:0:2000' - ); + $rrd_def = RrdDefinition::make() + ->addDataset('channel', 'GAUGE', 0, 200) + ->addDataset('txpow', 'GAUGE', 0, 200) + ->addDataset('radioutil', 'GAUGE', 0, 100) + ->addDataset('nummonclients', 'GAUGE', 0, 500) + ->addDataset('nummonbssid', 'GAUGE', 0, 200) + ->addDataset('numasoclients', 'GAUGE', 0, 500) + ->addDataset('interference', 'GAUGE', 0, 2000); $fields = array( 'channel' => $channel, diff --git a/includes/polling/bgp-peers.inc.php b/includes/polling/bgp-peers.inc.php index 1bc985e120..a2a47bc73f 100644 --- a/includes/polling/bgp-peers.inc.php +++ b/includes/polling/bgp-peers.inc.php @@ -1,5 +1,7 @@ addDataset('bgpPeerOutUpdates', 'COUNTER', null, 100000000000) + ->addDataset('bgpPeerInUpdates', 'COUNTER', null, 100000000000) + ->addDataset('bgpPeerOutTotal', 'COUNTER', null, 100000000000) + ->addDataset('bgpPeerInTotal', 'COUNTER', null, 100000000000) + ->addDataset('bgpPeerEstablished', 'GAUGE', 0); $fields = array( 'bgpPeerOutUpdates' => $bgpPeerOutUpdates, @@ -306,13 +307,12 @@ if ($config['enable_bgp']) { dbUpdate($peer['c_update'], 'bgpPeers_cbgp', '`device_id` = ? AND bgpPeerIdentifier = ? AND afi = ? AND safi = ?', array($device['device_id'], $peer['bgpPeerIdentifier'], $afi, $safi)); $cbgp_rrd_name = safename('cbgp-'.$peer['bgpPeerIdentifier'].".$afi.$safi"); - $cbgp_rrd_def = array( - 'DS:AcceptedPrefixes:GAUGE:600:U:100000000000', - 'DS:DeniedPrefixes:GAUGE:600:U:100000000000', - 'DS:AdvertisedPrefixes:GAUGE:600:U:100000000000', - 'DS:SuppressedPrefixes:GAUGE:600:U:100000000000', - 'DS:WithdrawnPrefixes:GAUGE:600:U:100000000000' - ); + $cbgp_rrd_def = RrdDefinition::make() + ->addDataset('AcceptedPrefixes', 'GAUGE', null, 100000000000) + ->addDataset('DeniedPrefixes', 'GAUGE', null, 100000000000) + ->addDataset('AdvertisedPrefixes', 'GAUGE', null, 100000000000) + ->addDataset('SuppressedPrefixes', 'GAUGE', null, 100000000000) + ->addDataset('WithdrawnPrefixes', 'GAUGE', null, 100000000000); $fields = array( 'AcceptedPrefixes' => $cbgpPeerAcceptedPrefixes, diff --git a/includes/polling/cipsec-tunnels.inc.php b/includes/polling/cipsec-tunnels.inc.php index ac02d8d25b..07a77edea3 100644 --- a/includes/polling/cipsec-tunnels.inc.php +++ b/includes/polling/cipsec-tunnels.inc.php @@ -1,5 +1,7 @@ addDataset($oid_ds, 'COUNTER', null, 1000000000); } $fields = array(); diff --git a/includes/polling/cisco-ace-loadbalancer.inc.php b/includes/polling/cisco-ace-loadbalancer.inc.php index ab211a0acb..c0465ac900 100644 --- a/includes/polling/cisco-ace-loadbalancer.inc.php +++ b/includes/polling/cisco-ace-loadbalancer.inc.php @@ -1,5 +1,7 @@ addDataset($oid_ds, 'GAUGE', -1, 100000000); } $fields = array(); diff --git a/includes/polling/cisco-ace-serverfarms.inc.php b/includes/polling/cisco-ace-serverfarms.inc.php index 0c76866818..096a027b07 100644 --- a/includes/polling/cisco-ace-serverfarms.inc.php +++ b/includes/polling/cisco-ace-serverfarms.inc.php @@ -1,5 +1,7 @@ addDataset($oid_ds, 'COUNTER', null, 1000000000); } $fields = array(); diff --git a/includes/polling/cisco-asa-firewall.inc.php b/includes/polling/cisco-asa-firewall.inc.php index 7470b0c0f0..444d85cc44 100644 --- a/includes/polling/cisco-asa-firewall.inc.php +++ b/includes/polling/cisco-asa-firewall.inc.php @@ -12,6 +12,8 @@ * the source code distribution for details. */ +use LibreNMS\RRD\RrdDefinition; + if ($device['os_group'] == 'cisco' && $device['os'] == 'asa' && $device['type'] == 'firewall') { $oid_list = 'cfwConnectionStatValue.protoIp.currentInUse'; $temp_data = snmpwalk_cache_double_oid($device, $oid_list, array(), 'CISCO-FIREWALL-MIB'); @@ -29,7 +31,7 @@ if ($device['os_group'] == 'cisco' && $device['os'] == 'asa' && $device['type'] } if ($data['currentInUse']) { - $rrd_def = 'DS:connections:GAUGE:600:0:U'; + $rrd_def = RrdDefinition::make()->addDataset('connections', 'GAUGE', 0); $fields = array( 'connections' => $data['currentInUse']['data'], ); diff --git a/includes/polling/cisco-cbqos.inc.php b/includes/polling/cisco-cbqos.inc.php index e81513d807..0fca3eea26 100644 --- a/includes/polling/cisco-cbqos.inc.php +++ b/includes/polling/cisco-cbqos.inc.php @@ -11,6 +11,8 @@ * the source code distribution for details. */ +use LibreNMS\RRD\RrdDefinition; + if ($device['os_group'] == "cisco") { $tmp_module = 'Cisco-CBQOS'; @@ -39,11 +41,10 @@ if ($device['os_group'] == "cisco") { $spid = $array['sp-id']; $spobj = $array['sp-obj']; $rrd_name = array('port', $ifIndex, 'cbqos', $spid, $spobj); - $rrd_def = array( - 'DS:postbits:COUNTER:600:0:U', - 'DS:bufferdrops:COUNTER:600:0:U', - 'DS:qosdrops:COUNTER:600:0:U' - ); + $rrd_def = RrdDefinition::make() + ->addDataset('postbits', 'COUNTER', 0) + ->addDataset('bufferdrops', 'COUNTER', 0) + ->addDataset('qosdrops', 'COUNTER', 0); // Let's print some debugging info. d_echo("\n\nComponent: ".$key."\n"); diff --git a/includes/polling/cisco-cef.inc.php b/includes/polling/cisco-cef.inc.php index a714e86a78..8548e82a17 100644 --- a/includes/polling/cisco-cef.inc.php +++ b/includes/polling/cisco-cef.inc.php @@ -1,5 +1,7 @@ addDataset('drop', 'DERIVE', 0, 1000000) + ->addDataset('punt', 'DERIVE', 0, 1000000) + ->addDataset('hostpunt', 'DERIVE', 0, 1000000); // Copy HC to non-HC if they exist if (is_numeric($cef_stat['cefSwitchingHCDrop'])) { diff --git a/includes/polling/cisco-ipsec-flow-monitor.inc.php b/includes/polling/cisco-ipsec-flow-monitor.inc.php index df7d73dc44..2aebf06264 100644 --- a/includes/polling/cisco-ipsec-flow-monitor.inc.php +++ b/includes/polling/cisco-ipsec-flow-monitor.inc.php @@ -1,5 +1,7 @@ addDataset('Tunnels', 'GAUGE', 0) + ->addDataset('InOctets', 'COUNTER', 0, 100000000000) + ->addDataset('OutOctets', 'COUNTER', 0, 100000000000) + ->addDataset('InDecompOctets', 'COUNTER', 0, 100000000000) + ->addDataset('OutUncompOctets', 'COUNTER', 0, 100000000000) + ->addDataset('InPkts', 'COUNTER', 0, 100000000000) + ->addDataset('OutPkts', 'COUNTER', 0, 100000000000) + ->addDataset('InDrops', 'COUNTER', 0, 100000000000) + ->addDataset('InReplayDrops', 'COUNTER', 0, 100000000000) + ->addDataset('OutDrops', 'COUNTER', 0, 100000000000) + ->addDataset('InAuths', 'COUNTER', 0, 100000000000) + ->addDataset('OutAuths', 'COUNTER', 0, 100000000000) + ->addDataset('InAuthFails', 'COUNTER', 0, 100000000000) + ->addDataset('OutAuthFails', 'COUNTER', 0, 100000000000) + ->addDataset('InDencrypts', 'COUNTER', 0, 100000000000) + ->addDataset('OutEncrypts', 'COUNTER', 0, 100000000000) + ->addDataset('InDecryptFails', 'COUNTER', 0, 100000000000) + ->addDataset('OutEncryptFails', 'COUNTER', 0, 100000000000) + ->addDataset('ProtocolUseFails', 'COUNTER', 0, 100000000000) + ->addDataset('NoSaFails', 'COUNTER', 0, 100000000000) + ->addDataset('SysCapFails', 'COUNTER', 0, 100000000000); $fields = array( 'Tunnels' => $data['cipSecGlobalActiveTunnels'], diff --git a/includes/polling/cisco-mac-accounting.inc.php b/includes/polling/cisco-mac-accounting.inc.php index faddabf996..40a63b39c6 100644 --- a/includes/polling/cisco-mac-accounting.inc.php +++ b/includes/polling/cisco-mac-accounting.inc.php @@ -1,5 +1,7 @@ $b_in:$b_out:$p_in:$p_out "); $rrd_name = array('cip', $ifIndex, $mac); - $rrd_dev = array( - 'DS:IN:COUNTER:600:0:12500000000', - 'DS:OUT:COUNTER:600:0:12500000000', - 'DS:PIN:COUNTER:600:0:12500000000', - 'DS:POUT:COUNTER:600:0:12500000000' - ); + $rrd_dev = RrdDefinition::make() + ->addDataset('IN', 'COUNTER', 0, 12500000000) + ->addDataset('OUT', 'COUNTER', 0, 12500000000) + ->addDataset('PIN', 'COUNTER', 0, 12500000000) + ->addDataset('POUT', 'COUNTER', 0, 12500000000); // FIXME - use memcached to make sure these values don't go backwards? $fields = array( diff --git a/includes/polling/cisco-otv.inc.php b/includes/polling/cisco-otv.inc.php index 1127f43877..271f42d2a7 100644 --- a/includes/polling/cisco-otv.inc.php +++ b/includes/polling/cisco-otv.inc.php @@ -11,6 +11,8 @@ * the source code distribution for details. */ +use LibreNMS\RRD\RrdDefinition; + if ($device['os_group'] == "cisco") { // Define some error messages $error_vpn = array(); @@ -127,7 +129,7 @@ if ($device['os_group'] == "cisco") { $label = $array['label']; $rrd_name = array('cisco', 'otv', $label, 'vlan'); - $rrd_def = 'DS:count:GAUGE:600:0:U'; + $rrd_def = RrdDefinition::make()->addDataset('count', 'GAUGE', 0); $fields = array( 'count' => $count_vlan @@ -174,7 +176,7 @@ if ($device['os_group'] == "cisco") { d_echo(" MAC Count: ".$count."\n"); $rrd_name = array('cisco', 'otv', $endpoint, 'mac'); - $rrd_def = 'DS:count:GAUGE:600:0:U'; + $rrd_def = RrdDefinition::make()->addDataset('count', 'GAUGE', 0); $fields = array( 'count' => $count ); diff --git a/includes/polling/cisco-remote-access-monitor.inc.php b/includes/polling/cisco-remote-access-monitor.inc.php index c47b66423b..c669d2efe8 100644 --- a/includes/polling/cisco-remote-access-monitor.inc.php +++ b/includes/polling/cisco-remote-access-monitor.inc.php @@ -1,5 +1,7 @@ addDataset('email', 'GAUGE', 0) + ->addDataset('ipsec', 'GAUGE', 0) + ->addDataset('l2l', 'GAUGE', 0) + ->addDataset('lb', 'GAUGE', 0) + ->addDataset('svc', 'GAUGE', 0) + ->addDataset('webvpn', 'GAUGE', 0); $fields = array( 'email' => $data['crasEmailNumSessions'], diff --git a/includes/polling/cisco-sla.inc.php b/includes/polling/cisco-sla.inc.php index 4548a07040..6c0f71c8c5 100644 --- a/includes/polling/cisco-sla.inc.php +++ b/includes/polling/cisco-sla.inc.php @@ -1,5 +1,7 @@ 0) { // The base RRD $rrd_name = array('sla', $sla_nr); - $rrd_def = 'DS:rtt:GAUGE:600:0:300000'; + $rrd_def = RrdDefinition::make()->addDataset('rtt', 'GAUGE', 0, 300000); $tags = compact('sla_nr', 'rrd_name', 'rrd_def'); data_update($device, 'sla', $tags, $fields); @@ -65,19 +67,18 @@ if (count($slas) > 0) { 'AvgDSJ' => $rttMonLatestOper['1.3.6.1.4.1.9.9.42.1.5.2.1.48'][$sla_nr], ); $rrd_name = array('sla', $sla_nr, $rtt_type); - $rrd_def = array( - 'DS:PacketLossSD:GAUGE:600:0:U', - 'DS:PacketLossDS:GAUGE:600:0:U', - 'DS:PacketOutOfSequence:GAUGE:600:0:U', - 'DS:PacketMIA:GAUGE:600:0:U', - 'DS:PacketLateArrival:GAUGE:600:0:U', - 'DS:MOS:GAUGE:600:0:U', - 'DS:ICPIF:GAUGE:600:0:U', - 'DS:OWAvgSD:GAUGE:600:0:U', - 'DS:OWAvgDS:GAUGE:600:0:U', - 'DS:AvgSDJ:GAUGE:600:0:U', - 'DS:AvgDSJ:GAUGE:600:0:U', - ); + $rrd_def = RrdDefinition::make() + ->addDataset('PacketLossSD', 'GAUGE', 0) + ->addDataset('PacketLossDS', 'GAUGE', 0) + ->addDataset('PacketOutOfSequence', 'GAUGE', 0) + ->addDataset('PacketMIA', 'GAUGE', 0) + ->addDataset('PacketLateArrival', 'GAUGE', 0) + ->addDataset('MOS', 'GAUGE', 0) + ->addDataset('ICPIF', 'GAUGE', 0) + ->addDataset('OWAvgSD', 'GAUGE', 0) + ->addDataset('OWAvgDS', 'GAUGE', 0) + ->addDataset('AvgSDJ', 'GAUGE', 0) + ->addDataset('AvgDSJ', 'GAUGE', 0); $tags = compact('rrd_name', 'rrd_def', 'sla_nr', 'rtt_type'); data_update($device, 'sla', $tags, $jitter); $fields = array_merge($fields, $jitter); @@ -96,18 +97,17 @@ if (count($slas) > 0) { 'JitterIAJIn' => $rttMonLatestOper['1.3.6.1.4.1.9.9.42.1.5.4.1.50'][$sla_nr], ); $rrd_name = array('sla', $sla_nr, $rtt_type); - $rrd_def = array( - 'DS:PacketLoss:GAUGE:600:0:U', - 'DS:PacketOosSD:GAUGE:600:0:U', - 'DS:PacketOosDS:GAUGE:600:0:U', - 'DS:PacketLateArrival:GAUGE:600:0:U', - 'DS:JitterAvgSD:GAUGE:600:0:U', - 'DS:JitterAvgDS:GAUGE:600:0:U', - 'DS:LatencyOWAvgSD:GAUGE:600:0:U', - 'DS:LatencyOWAvgDS:GAUGE:600:0:U', - 'DS:JitterIAJOut:GAUGE:600:0:U', - 'DS:JitterIAJIn:GAUGE:600:0:U', - ); + $rrd_def = RrdDefinition::make() + ->addDataset('PacketLoss', 'GAUGE', 0) + ->addDataset('PacketOosSD', 'GAUGE', 0) + ->addDataset('PacketOosDS', 'GAUGE', 0) + ->addDataset('PacketLateArrival', 'GAUGE', 0) + ->addDataset('JitterAvgSD', 'GAUGE', 0) + ->addDataset('JitterAvgDS', 'GAUGE', 0) + ->addDataset('LatencyOWAvgSD', 'GAUGE', 0) + ->addDataset('LatencyOWAvgDS', 'GAUGE', 0) + ->addDataset('JitterIAJOut', 'GAUGE', 0) + ->addDataset('JitterIAJIn', 'GAUGE', 0); $tags = compact('rrd_name', 'rrd_def', 'sla_nr', 'rtt_type'); data_update($device, 'sla', $tags, $icmpjitter); $fields = array_merge($fields, $icmpjitter); diff --git a/includes/polling/cisco-voice/cisco-iosdsp.inc.php b/includes/polling/cisco-voice/cisco-iosdsp.inc.php index 246cce8652..b954ff9ce9 100644 --- a/includes/polling/cisco-voice/cisco-iosdsp.inc.php +++ b/includes/polling/cisco-voice/cisco-iosdsp.inc.php @@ -11,6 +11,8 @@ * the source code distribution for details. */ +use LibreNMS\RRD\RrdDefinition; + if ($device['os_group'] == "cisco") { // Total $total = 0; @@ -27,10 +29,9 @@ if ($device['os_group'] == "cisco") { $active += $value['']; } - $rrd_def = array( - 'DS:total:GAUGE:600:0:U', - 'DS:active:GAUGE:600:0:U' - ); + $rrd_def = RrdDefinition::make() + ->addDataset('total', 'GAUGE', 0) + ->addDataset('active', 'GAUGE', 0); $fields = array( 'total' => $total, diff --git a/includes/polling/cisco-voice/cisco-iosmtp.inc.php b/includes/polling/cisco-voice/cisco-iosmtp.inc.php index a60ff015eb..f1ac7b21c7 100644 --- a/includes/polling/cisco-voice/cisco-iosmtp.inc.php +++ b/includes/polling/cisco-voice/cisco-iosmtp.inc.php @@ -11,6 +11,8 @@ * the source code distribution for details. */ +use LibreNMS\RRD\RrdDefinition; + if ($device['os_group'] == "cisco") { // Total $total = snmpwalk_cache_oid_num($device, "1.3.6.1.4.1.9.9.86.1.6.4.1.3", null); @@ -24,10 +26,9 @@ if ($device['os_group'] == "cisco") { // Active $active = $total - $available; - $rrd_def = array( - 'DS:total:GAUGE:600:0:U', - 'DS:active:GAUGE:600:0:U' - ); + $rrd_def = RrdDefinition::make() + ->addDataset('total', 'GAUGE', 0) + ->addDataset('active', 'GAUGE', 0); $fields = array( 'total' => $total, diff --git a/includes/polling/cisco-voice/cisco-iospri.inc.php b/includes/polling/cisco-voice/cisco-iospri.inc.php index 963956616f..e64a3097e5 100644 --- a/includes/polling/cisco-voice/cisco-iospri.inc.php +++ b/includes/polling/cisco-voice/cisco-iospri.inc.php @@ -11,6 +11,8 @@ * the source code distribution for details. */ +use LibreNMS\RRD\RrdDefinition; + if ($device['os_group'] == "cisco") { // TODO: Need to test partial PRI. @@ -30,10 +32,9 @@ if ($device['os_group'] == "cisco") { $active = $active['1.3.6.1.4.1.9.10.19.1.1.4.0']; if (isset($active) && $active > 0) { - $rrd_def = array( - 'DS:total:GAUGE:600:0:U', - 'DS:active:GAUGE:600:0:U' - ); + $rrd_def = RrdDefinition::make() + ->addDataset('total', 'GAUGE', 0) + ->addDataset('active', 'GAUGE', 0); $fields = array( 'total' => $total, diff --git a/includes/polling/cisco-voice/cisco-iosxcode.inc.php b/includes/polling/cisco-voice/cisco-iosxcode.inc.php index aa52d712b1..dd29cfa338 100644 --- a/includes/polling/cisco-voice/cisco-iosxcode.inc.php +++ b/includes/polling/cisco-voice/cisco-iosxcode.inc.php @@ -11,6 +11,8 @@ * the source code distribution for details. */ +use LibreNMS\RRD\RrdDefinition; + if ($device['os_group'] == "cisco") { // Total $total = snmpwalk_cache_oid_num($device, "1.3.6.1.4.1.9.9.86.1.7.1.0", null); @@ -24,10 +26,9 @@ if ($device['os_group'] == "cisco") { // Active $active = $total - $available; - $rrd_def = array( - 'DS:total:GAUGE:600:0:U', - 'DS:active:GAUGE:600:0:U' - ); + $rrd_def = RrdDefinition::make() + ->addDataset('total', 'GAUGE', 0) + ->addDataset('active', 'GAUGE', 0); $fields = array( 'total' => $total, diff --git a/includes/polling/cisco-vpdn.inc.php b/includes/polling/cisco-vpdn.inc.php index ac0dd55138..8d19bc0c93 100644 --- a/includes/polling/cisco-vpdn.inc.php +++ b/includes/polling/cisco-vpdn.inc.php @@ -1,5 +1,7 @@ $vpdn) { if ($vpdn['cvpdnSystemTunnelTotal'] || $vpdn['cvpdnSystemSessionTotal']) { $rrd_name = array('vpdn', $type); - $rrd_def = array( - 'DS:tunnels:GAUGE:600:0:U', - 'DS:sessions:GAUGE:600:0:U', - 'DS:denied:COUNTER:600:0:100000' - ); + $rrd_def = RrdDefinition::make() + ->addDataset('tunnels', 'GAUGE', 0) + ->addDataset('sessions', 'GAUGE', 0) + ->addDataset('denied', 'COUNTER', 0, 100000); $fields = array( 'tunnels' => $vpdn['cvpdnSystemTunnelTotal'], diff --git a/includes/polling/core.inc.php b/includes/polling/core.inc.php index 59d0c697c7..0828072ddf 100644 --- a/includes/polling/core.inc.php +++ b/includes/polling/core.inc.php @@ -12,6 +12,8 @@ * See COPYING for more details. */ +use LibreNMS\RRD\RrdDefinition; + unset($poll_device); $snmpdata = snmp_get_multi($device, 'sysUpTime.0 sysLocation.0 sysContact.0 sysName.0 sysObjectID.0', '-OQnUst', 'SNMPv2-MIB:HOST-RESOURCES-MIB:SNMP-FRAMEWORK-MIB'); @@ -56,7 +58,7 @@ if (is_numeric($uptime) && ($config['os'][$device['os']]['bad_uptime'] !== true) } $tags = array( - 'rrd_def' => 'DS:uptime:GAUGE:600:0:U', + 'rrd_def' => RrdDefinition::make()->addDataset('uptime', 'GAUGE', 0), ); data_update($device, 'uptime', $tags, $uptime); diff --git a/includes/polling/entity-physical/ios.inc.php b/includes/polling/entity-physical/ios.inc.php index 4d43f312e3..ab415e5ef7 100644 --- a/includes/polling/entity-physical/ios.inc.php +++ b/includes/polling/entity-physical/ios.inc.php @@ -1,5 +1,7 @@ $entry) { } $rrd_name = array('c6kxbar', $index, $subindex); - $rrd_def = array( - 'DS:inutil:GAUGE:600:0:100', - 'DS:oututil:GAUGE:600:0:100', - 'DS:outdropped:DERIVE:600:0:125000000000', - 'DS:outerrors:DERIVE:600:0:125000000000', - 'DS:inerrors:DERIVE:600:0:125000000000' - ); + $rrd_def = RrdDefinition::make() + ->addDataset('inutil', 'GAUGE', 0, 100) + ->addDataset('oututil', 'GAUGE', 0, 100) + ->addDataset('outdropped', 'DERIVE', 0, 125000000000) + ->addDataset('outerrors', 'DERIVE', 0, 125000000000) + ->addDataset('inerrors', 'DERIVE', 0, 125000000000); $fields = array( 'inutil' => $entry['cc6kxbarStatisticsInUtil'], diff --git a/includes/polling/functions.inc.php b/includes/polling/functions.inc.php index 9fe1e9d3f3..16c1467524 100644 --- a/includes/polling/functions.inc.php +++ b/includes/polling/functions.inc.php @@ -1,5 +1,7 @@ addDataset('sensor', 'GAUGE', -20000, 20000); echo "$sensor_value $unit\n"; @@ -268,7 +270,7 @@ function poll_device($device, $options) // save per-module poller stats $tags = array( 'module' => $module, - 'rrd_def' => 'DS:poller:GAUGE:600:0:U', + 'rrd_def' => RrdDefinition::make()->addDataset('poller', 'GAUGE', 0), 'rrd_name' => array('poller-perf', $module), ); $fields = array( @@ -324,7 +326,7 @@ function poll_device($device, $options) // Poller performance if (!empty($device_time)) { $tags = array( - 'rrd_def' => 'DS:poller:GAUGE:600:0:U', + 'rrd_def' => RrdDefinition::make()->addDataset('poller', 'GAUGE', 0), 'module' => 'ALL', ); $fields = array( @@ -337,7 +339,7 @@ function poll_device($device, $options) // Ping response if (can_ping_device($attribs) === true && !empty($response['ping_time'])) { $tags = array( - 'rrd_def' => 'DS:ping:GAUGE:600:0:65535', + 'rrd_def' => RrdDefinition::make()->addDataset('ping', 'GAUGE', 0, 65535), ); $fields = array( 'ping' => $response['ping_time'], @@ -383,7 +385,7 @@ function poll_mib_def($device, $mib_name_table, $mib_subdir, $mib_oids, $mib_gra $measurement_name = strtolower($file); } - $rrd_def = array(); + $rrd_def = new RrdDefinition(); $oidglist = array(); $oidnamelist = array(); foreach ($mib_oids as $oid => $param) { @@ -393,16 +395,15 @@ function poll_mib_def($device, $mib_name_table, $mib_subdir, $mib_oids, $mib_gra $oiddstype = $param[3]; $oiddsopts = $param[4]; - if (strlen($oiddsname) > 19) { - $oiddsname = substr($oiddsname, 0, 19); - } - if (empty($oiddsopts)) { - $oiddsopts = '600:U:100000000000'; + $rrd_def->addDataset($oiddsname, $oiddstype, null, 100000000000); + } else { + $min = array_key_exists('min', $oiddsopts) ? $oiddsopts['min'] : null; + $max = array_key_exists('max', $oiddsopts) ? $oiddsopts['max'] : null; + $heartbeat = array_key_exists('heartbeat', $oiddsopts) ? $oiddsopts['heartbeat'] : null; + $rrd_def->addDataset($oiddsname, $oiddstype, $min, $max, $heartbeat); } - $rrd_def[] = 'DS:'.$oiddsname.':'.$oiddstype.':'.$oiddsopts; - if ($oidindex != '') { $fulloid = $oid.'.'.$oidindex; } else { diff --git a/includes/polling/hr-mib.inc.php b/includes/polling/hr-mib.inc.php index 56091c7429..f5f3bd615c 100644 --- a/includes/polling/hr-mib.inc.php +++ b/includes/polling/hr-mib.inc.php @@ -2,12 +2,14 @@ // HOST-RESOURCES-MIB // Generic System Statistics +use LibreNMS\RRD\RrdDefinition; + $oid_list = 'hrSystemProcesses.0 hrSystemNumUsers.0'; $hrSystem = snmp_get_multi($device, $oid_list, '-OUQs', 'HOST-RESOURCES-MIB'); if (is_numeric($hrSystem[0]['hrSystemProcesses'])) { $tags = array( - 'rrd_def' => 'DS:procs:GAUGE:600:0:U', + 'rrd_def' => RrdDefinition::make()->addDataset('procs', 'GAUGE', 0), ); $fields = array( 'procs' => $hrSystem[0]['hrSystemProcesses'], @@ -21,7 +23,7 @@ if (is_numeric($hrSystem[0]['hrSystemProcesses'])) { if (is_numeric($hrSystem[0]['hrSystemNumUsers'])) { $tags = array( - 'rrd_def' => 'DS:users:GAUGE:600:0:U' + 'rrd_def' => RrdDefinition::make()->addDataset('users', 'GAUGE', 0) ); $fields = array( 'users' => $hrSystem[0]['hrSystemNumUsers'], diff --git a/includes/polling/ipSystemStats.inc.php b/includes/polling/ipSystemStats.inc.php index 07b787c209..685cde94c6 100644 --- a/includes/polling/ipSystemStats.inc.php +++ b/includes/polling/ipSystemStats.inc.php @@ -47,6 +47,8 @@ // IP-MIB::ipSystemStatsRefreshRate.ipv4 = Gauge32: 30000 milli-seconds // IP-MIB::ipSystemStatsRefreshRate.ipv6 = Gauge32: 30000 milli-seconds +use LibreNMS\RRD\RrdDefinition; + $data = snmpwalk_cache_oid($device, 'ipSystemStats', null, 'IP-MIB'); if ($data) { @@ -94,13 +96,12 @@ if ($data) { } $rrd_name = array('ipSystemStats', $af); - $rrd_def = array(); + $rrd_def = new RrdDefinition(); $fields = array(); foreach ($oids as $oid) { $oid_ds = str_replace('ipSystemStats', '', $oid); - $oid_ds = substr($oid_ds, 0, 19); - $rrd_def[] = "DS:$oid_ds:COUNTER:600:U:100000000000"; + $rrd_def->addDataset($oid_ds, 'COUNTER'); if (strstr($stats[$oid], 'No') || strstr($stats[$oid], 'd') || strstr($stats[$oid], 's')) { $stats[$oid] = '0'; } diff --git a/includes/polling/ipmi.inc.php b/includes/polling/ipmi.inc.php index 21b1854fce..aee8633bcd 100644 --- a/includes/polling/ipmi.inc.php +++ b/includes/polling/ipmi.inc.php @@ -1,5 +1,7 @@ addDataset('sensor', 'GAUGE', -20000, 20000); $fields = array( 'sensor' => $sensor, diff --git a/includes/polling/junose-atm-vp.inc.php b/includes/polling/junose-atm-vp.inc.php index ae2e544ca7..518fb26570 100644 --- a/includes/polling/junose-atm-vp.inc.php +++ b/includes/polling/junose-atm-vp.inc.php @@ -1,5 +1,7 @@ addDataset('incells', 'DERIVE', 0, 125000000000) + ->addDataset('outcells', 'DERIVE', 0, 125000000000) + ->addDataset('inpackets', 'DERIVE', 0, 125000000000) + ->addDataset('outpackets', 'DERIVE', 0, 125000000000) + ->addDataset('inpacketoctets', 'DERIVE', 0, 125000000000) + ->addDataset('outpacketoctets', 'DERIVE', 0, 125000000000) + ->addDataset('inpacketerrors', 'DERIVE', 0, 125000000000) + ->addDataset('outpacketerrors', 'DERIVE', 0, 125000000000); foreach ($vp_rows as $vp) { echo '.'; diff --git a/includes/polling/loadbalancers/f5-ltm.inc.php b/includes/polling/loadbalancers/f5-ltm.inc.php index abff4b41dd..a43858a2d1 100644 --- a/includes/polling/loadbalancers/f5-ltm.inc.php +++ b/includes/polling/loadbalancers/f5-ltm.inc.php @@ -11,6 +11,8 @@ * the source code distribution for details. */ +use LibreNMS\RRD\RrdDefinition; + // Define some error messages $error_poolaction = array(); $error_poolaction[0] = "Unused"; @@ -78,13 +80,12 @@ if (count($components > 0)) { $rrd_name = array($type, $label, $hash); if ($type == 'f5-ltm-vs') { - $rrd_def = array( - 'DS:pktsin:COUNTER:600:0:U', - 'DS:pktsout:COUNTER:600:0:U', - 'DS:bytesin:COUNTER:600:0:U', - 'DS:bytesout:COUNTER:600:0:U', - 'DS:totconns:COUNTER:600:0:U', - ); + $rrd_def = RrdDefinition::make() + ->addDataset('pktsin', 'COUNTER', 0) + ->addDataset('pktsout', 'COUNTER', 0) + ->addDataset('bytesin', 'COUNTER', 0) + ->addDataset('bytesout', 'COUNTER', 0) + ->addDataset('totconns', 'COUNTER', 0); $fields = array( 'pktsin' => $ltmVirtualServStatEntryPktsin['1.3.6.1.4.1.3375.2.2.10.2.3.1.6.'.$UID], @@ -111,10 +112,9 @@ if (count($components > 0)) { $array['error'] = ''; } } elseif ($type == 'f5-ltm-pool') { - $rrd_def = array( - 'DS:minup:GAUGE:600:0:U', - 'DS:currup:GAUGE:600:0:U', - ); + $rrd_def = RrdDefinition::make() + ->addDataset('minup', 'GAUGE', 0) + ->addDataset('currup', 'GAUGE', 0); $array['minup'] = $ltmPoolEntryMinup['1.3.6.1.4.1.3375.2.2.5.1.2.1.4.'.$UID]; $array['minupstatus'] = $ltmPoolEntryMinupstatus['1.3.6.1.4.1.3375.2.2.5.1.2.1.5.'.$UID]; @@ -142,13 +142,12 @@ if (count($components > 0)) { $array['error'] = ''; } } elseif ($type == 'f5-ltm-poolmember') { - $rrd_def = array( - 'DS:pktsin:COUNTER:600:0:U', - 'DS:pktsout:COUNTER:600:0:U', - 'DS:bytesin:COUNTER:600:0:U', - 'DS:bytesout:COUNTER:600:0:U', - 'DS:totconns:COUNTER:600:0:U', - ); + $rrd_def = RrdDefinition::make() + ->addDataset('pktsin', 'COUNTER', 0) + ->addDataset('pktsout', 'COUNTER', 0) + ->addDataset('bytesin', 'COUNTER', 0) + ->addDataset('bytesout', 'COUNTER', 0) + ->addDataset('totconns', 'COUNTER', 0); $array['state'] = $ltmPoolMbrStatusEntryState['1.3.6.1.4.1.3375.2.2.5.6.2.1.5.'.$UID]; $array['available'] = $ltmPoolMbrStatusEntryAvail['1.3.6.1.4.1.3375.2.2.5.6.2.1.6.'.$UID]; diff --git a/includes/polling/mempools.inc.php b/includes/polling/mempools.inc.php index f789e517e9..7d96ac22c8 100644 --- a/includes/polling/mempools.inc.php +++ b/includes/polling/mempools.inc.php @@ -1,5 +1,7 @@ addDataset('used', 'GAUGE', 0) + ->addDataset('free', 'GAUGE', 0); $fields = array( 'used' => $mempool['used'], diff --git a/includes/polling/mib/siklu-mib.inc.php b/includes/polling/mib/siklu-mib.inc.php index e9e6c1ac36..ef14e15eaf 100644 --- a/includes/polling/mib/siklu-mib.inc.php +++ b/includes/polling/mib/siklu-mib.inc.php @@ -40,14 +40,14 @@ $mib_oids = array( 'rfInPkts', 'In Packets', 'DERIVE', - '600:0:12500000000', + array('min' => 0, 'max' => 12500000000), ), 'rfOutPkts' => array( '1', 'rfOutPkts', 'Out Packets', 'DERIVE', - '600:0:12500000000', + array('min' => 0, 'max' => 12500000000), ), 'rfInGoodPkts' => array( '1', @@ -72,14 +72,14 @@ $mib_oids = array( 'rfInOctets', 'In Packets', 'DERIVE', - '600:0:12500000000', + array('min' => 0, 'max' => 12500000000), ), 'rfOutOctets' => array( '1', 'rfOutOctets', 'Out Packets', 'DERIVE', - '600:0:12500000000', + array('min' => 0, 'max' => 12500000000), ), 'rfInGoodOctets' => array( '1', diff --git a/includes/polling/netscaler-vsvr.inc.php b/includes/polling/netscaler-vsvr.inc.php index 91a301d0c0..c1090bbd2a 100644 --- a/includes/polling/netscaler-vsvr.inc.php +++ b/includes/polling/netscaler-vsvr.inc.php @@ -30,6 +30,8 @@ // NS-ROOT-MIB::vsvrTotSpillOvers."librenms" = Counter32: 0 // NS-ROOT-MIB::vsvrTotalClients."librenms" = Counter64: 43023 // NS-ROOT-MIB::vsvrClientConnOpenRate."librenms" = STRING: "0" +use LibreNMS\RRD\RrdDefinition; + if ($device['os'] == 'netscaler') { $oids_gauge = array( 'vsvrCurClntConnections', @@ -53,14 +55,14 @@ if ($device['os'] == 'netscaler') { $oids = array_merge($oids_gauge, $oids_counter); - $rrd_def = array(); + $rrd_def = new RrdDefinition(); foreach ($oids_gauge as $oid) { - $oid_ds = substr(str_replace('vsvr', '', $oid), 0, 19); - $rrd_def[] = "DS:$oid_ds:GAUGE:600:U:100000000000"; + $oid_ds = str_replace('vsvr', '', $oid); + $rrd_def->addDataset($oid_ds, 'GAUGE', null, 100000000000); } foreach ($oids_counter as $oid) { - $oid_ds = substr(str_replace('vsvr', '', $oid), 0, 19); - $rrd_def[] = "DS:$oid_ds:COUNTER:600:U:100000000000"; + $oid_ds = str_replace('vsvr', '', $oid); + $rrd_def->addDataset($oid_ds, 'COUNTER', null, 100000000000); } $vsvr_array = snmpwalk_cache_oid($device, 'vserverEntry', array(), 'NS-ROOT-MIB'); diff --git a/includes/polling/netstats/netstats-icmp.inc.php b/includes/polling/netstats/netstats-icmp.inc.php index e3ee3ba1e5..75eec08bc3 100644 --- a/includes/polling/netstats/netstats-icmp.inc.php +++ b/includes/polling/netstats/netstats-icmp.inc.php @@ -1,5 +1,7 @@ addDataset($oid, 'COUNTER', null, 100000000000); $fields[$oid] = isset($data[$oid]) ? $data[$oid] : 'U'; } diff --git a/includes/polling/netstats/netstats-ip.inc.php b/includes/polling/netstats/netstats-ip.inc.php index b53199e93d..906634ecb4 100644 --- a/includes/polling/netstats/netstats-ip.inc.php +++ b/includes/polling/netstats/netstats-ip.inc.php @@ -1,5 +1,7 @@ addDataset($oids, 'COUNTER', null, 100000000000); $snmpstring .= ' IP-MIB::'.$oid.'.0'; } diff --git a/includes/polling/netstats/netstats-ip_forward.inc.php b/includes/polling/netstats/netstats-ip_forward.inc.php index f9da1e126c..5db7ef7a7b 100644 --- a/includes/polling/netstats/netstats-ip_forward.inc.php +++ b/includes/polling/netstats/netstats-ip_forward.inc.php @@ -1,10 +1,12 @@ addDataset($oid, 'GAUGE', null, 5000000); $data = snmp_get($device, 'IP-FORWARD-MIB::' . $oid . '.0', '-OQv'); if (is_numeric($data)) { $value = $data; diff --git a/includes/polling/netstats/netstats-snmp.inc.php b/includes/polling/netstats/netstats-snmp.inc.php index d3ddc0bbf8..53699bde69 100644 --- a/includes/polling/netstats/netstats-snmp.inc.php +++ b/includes/polling/netstats/netstats-snmp.inc.php @@ -1,5 +1,7 @@ addDataset($oid, 'COUNTER', null, 100000000000); $fields[$oid] = isset($data[0][$oid]) ? $data[0][$oid] : 'U'; } diff --git a/includes/polling/netstats/netstats-tcp.inc.php b/includes/polling/netstats/netstats-tcp.inc.php index 6010188cde..1f5c21379d 100644 --- a/includes/polling/netstats/netstats-tcp.inc.php +++ b/includes/polling/netstats/netstats-tcp.inc.php @@ -1,5 +1,7 @@ addDataset($oid, 'COUNTER', null, 10000000); $snmpstring .= ' TCP-MIB::'.$oid.'.0'; } diff --git a/includes/polling/netstats/netstats-udp.inc.php b/includes/polling/netstats/netstats-udp.inc.php index 73fe7d7be2..360fcc29e8 100644 --- a/includes/polling/netstats/netstats-udp.inc.php +++ b/includes/polling/netstats/netstats-udp.inc.php @@ -1,5 +1,7 @@ addDataset($oid, 'COUNTER', null, 1000000); // Limit to 1MPPS? $snmpstring .= ' UDP-MIB::'.$oid.'.0'; } diff --git a/includes/polling/ntp.inc.php b/includes/polling/ntp.inc.php index 7668f657fd..ea3bbc48a6 100644 --- a/includes/polling/ntp.inc.php +++ b/includes/polling/ntp.inc.php @@ -12,10 +12,10 @@ * * This module will display NTP details from various device types. * To display, modules must create rrd's named: ntp-%PEER%.rrd with the following DS': - * DS:stratum:GAUGE:600:0:U - * DS:offset:GAUGE:600:0:U - * DS:delay:GAUGE:600:0:U - * DS:dispersion:GAUGE:600:0:U + * DS:stratum:GAUGE:'.$config['rrd']['heartbeat'].':0:U + * DS:offset:GAUGE:'.$config['rrd']['heartbeat'].':0:U + * DS:delay:GAUGE:'.$config['rrd']['heartbeat'].':0:U + * DS:dispersion:GAUGE:'.$config['rrd']['heartbeat'].':0:U */ if ($device['os_group'] == 'cisco') { diff --git a/includes/polling/ntp/cisco.inc.php b/includes/polling/ntp/cisco.inc.php index 8a30cd2d89..b7354cc28e 100644 --- a/includes/polling/ntp/cisco.inc.php +++ b/includes/polling/ntp/cisco.inc.php @@ -11,6 +11,8 @@ * the source code distribution for details. */ +use LibreNMS\RRD\RrdDefinition; + $tmp_module = 'ntp'; $component = new LibreNMS\Component(); @@ -34,12 +36,11 @@ if (count($components > 0)) { // Let's make sure the rrd is setup for this class. $rrd_name = array('ntp', $peer); - $rrd_def = array( - 'DS:stratum:GAUGE:600:0:U', - 'DS:offset:GAUGE:600:0:U', - 'DS:delay:GAUGE:600:0:U', - 'DS:dispersion:GAUGE:600:0:U', - ); + $rrd_def = RrdDefinition::make() + ->addDataset('stratum', 'GAUGE', 0) + ->addDataset('offset', 'GAUGE', 0) + ->addDataset('delay', 'GAUGE', 0) + ->addDataset('dispersion', 'GAUGE', 0); $array['stratum'] = $cntpPeersVarEntry['1.3.6.1.4.1.9.9.168.1.2.1.1'][9][$array['UID']]; // Set the status, 16 = Bad diff --git a/includes/polling/os/ciscowlc.inc.php b/includes/polling/os/ciscowlc.inc.php index 81a8b8c47e..bc0e63ae06 100644 --- a/includes/polling/os/ciscowlc.inc.php +++ b/includes/polling/os/ciscowlc.inc.php @@ -12,6 +12,8 @@ global $config; +use LibreNMS\RRD\RrdDefinition; + $oids = 'entPhysicalModelName.1 entPhysicalSoftwareRev.1 entPhysicalSerialNum.1'; $data = snmp_get_multi($device, $oids, '-OQUs', 'ENTITY-MIB'); @@ -45,10 +47,9 @@ foreach ($APstats as $key => $value) { $numClients += $value['bsnApIfNoOfUsers']; } -$rrd_def = array( - 'DS:NUMAPS:GAUGE:600:0:12500000000', - 'DS:NUMCLIENTS:GAUGE:600:0:12500000000' -); +$rrd_def = RrdDefinition::make() + ->addDataset('NUMAPS', 'GAUGE', 0, 12500000000) + ->addDataset('NUMCLIENTS', 'GAUGE', 0, 12500000000); $fields = array( 'NUMAPS' => $numAccessPoints, @@ -61,7 +62,7 @@ data_update($device, 'ciscowlc', $tags, $fields); // also save the info about how many clients in the same place as the wireless module $radio = 1; $rrd_name = 'wificlients-radio'.$radio; -$rrd_def = 'DS:wificlients:GAUGE:600:-273:10000'; +$rrd_def = RrdDefinition::make()->addDataset('wificlients', 'GAUGE', -273, 10000); $fields = array( 'wificlients' => $numClients @@ -109,15 +110,14 @@ foreach ($radios as $key => $value) { } $rrd_name = array('arubaap', $name.$radionum); - $rrd_def = array( - 'DS:channel:GAUGE:600:0:200', - 'DS:txpow:GAUGE:600:0:200', - 'DS:radioutil:GAUGE:600:0:100', - 'DS:nummonclients:GAUGE:600:0:500', - 'DS:nummonbssid:GAUGE:600:0:200', - 'DS:numasoclients:GAUGE:600:0:500', - 'DS:interference:GAUGE:600:0:2000' - ); + $rrd_def = RrdDefinition::make() + ->addDataset('channel', 'GAUGE', 0, 200) + ->addDataset('txpow', 'GAUGE', 0, 200) + ->addDataset('radioutil', 'GAUGE', 0, 100) + ->addDataset('nummonclients', 'GAUGE', 0, 500) + ->addDataset('nummonbssid', 'GAUGE', 0, 200) + ->addDataset('numasoclients', 'GAUGE', 0, 500) + ->addDataset('interference', 'GAUGE', 0, 2000); $fields = array( 'channel' => $channel, diff --git a/includes/polling/os/fortigate.inc.php b/includes/polling/os/fortigate.inc.php index 5abb7422af..daf3d2f36d 100644 --- a/includes/polling/os/fortigate.inc.php +++ b/includes/polling/os/fortigate.inc.php @@ -1,4 +1,7 @@ addDataset('sessions', 'GAUGE', 0, 3000000); print "Sessions: $sessions\n"; $fields = array( @@ -26,7 +29,7 @@ if (is_numeric($sessions)) { $cpu_usage = snmp_get($device, 'FORTINET-FORTIGATE-MIB::fgSysCpuUsage.0', '-Ovq'); if (is_numeric($cpu_usage)) { - $rrd_def = 'DS:LOAD:GAUGE:600:-1:100'; + $rrd_def = RrdDefinition::make()->addDataset('LOAD', 'GAUGE', -1, 100); echo "CPU: $cpu_usage%\n"; $fields = array( diff --git a/includes/polling/os/misc/netscaler-stats.inc.php b/includes/polling/os/misc/netscaler-stats.inc.php index 4f25ee0dca..252ee2baa5 100644 --- a/includes/polling/os/misc/netscaler-stats.inc.php +++ b/includes/polling/os/misc/netscaler-stats.inc.php @@ -1,5 +1,7 @@ addDataset($oid_ds, 'GAUGE', null, 100000000000); } foreach ($oids_counter as $oid) { - $oid_ds = substr(str_replace('tcp', '', str_replace('Active', 'Ac', str_replace('Passive', 'Ps', str_replace('Zombie', 'Zom', $oid)))), 0, 19); - $rrd_def[] = "DS:$oid_ds:COUNTER:600:U:100000000000"; + $oid_ds = str_replace($shorten, $short_replacement, $oid); + $rrd_def->addDataset($oid_ds, 'COUNTER', null, 100000000000); } $fields = array(); @@ -125,4 +141,4 @@ if ($device['os'] == 'netscaler') { $graphs['netscaler_tcp_pkts'] = true; }//end if -unset($oids_gauge, $oids_counter, $oids, $data, $tags, $fields, $rrd_def); +unset($oids_gauge, $oids_counter, $oids, $data, $tags, $fields, $rrd_def, $shorten, $short_replacement); diff --git a/includes/polling/os/nios.inc.php b/includes/polling/os/nios.inc.php index 3d96db294d..d783b18707 100644 --- a/includes/polling/os/nios.inc.php +++ b/includes/polling/os/nios.inc.php @@ -1,5 +1,7 @@ addDataset('success', 'DERIVE', 0) + ->addDataset('failure', 'DERIVE', 0) + ->addDataset('reject', 'DERIVE', 0) + ->addDataset('prereq_reject', 'DERIVE', 0); $fields = array( 'success' => $data[0]['ibDDNSUpdateSuccess'], @@ -46,10 +47,9 @@ $oids = $data = snmp_get_multi($device, $oids, '-OQUs', $mibs); -$rrd_def = array( - 'DS:PerfAA:GAUGE:600:0:U', - 'DS:PerfnonAA:GAUGE:600:0:U' -); +$rrd_def = RrdDefinition::make() + ->addDataset('PerfAA', 'GAUGE', 0) + ->addDataset('PerfnonAA', 'GAUGE', 0); $fields = array( 'PerfAA' => $data[0]['ibNetworkMonitorDNSAAT1AvgLatency'], @@ -72,12 +72,11 @@ $oids = $data = snmp_get_multi($device, $oids, '-OQUs', $mibs); -$rrd_def = array( - 'DS:success:DERIVE:600:0:U', - 'DS:failure:DERIVE:600:0:U', - 'DS:nxdomain:DERIVE:600:0:U', - 'DS:nxrrset:DERIVE:600:0:U' -); +$rrd_def = RrdDefinition::make() + ->addDataset('success', 'DERIVE', 0) + ->addDataset('failure', 'DERIVE', 0) + ->addDataset('nxdomain', 'DERIVE', 0) + ->addDataset('nxrrset', 'DERIVE', 0); $fields = array( 'success' => $data['"summary"']['ibBindZoneSuccess'], @@ -108,17 +107,16 @@ $oids = $data = snmp_get_multi($device, $oids, '-OQUs', $mibs); -$rrd_def = array( - 'DS:ack:DERIVE:600:0:U', - 'DS:decline:DERIVE:600:0:U', - 'DS:discover:DERIVE:600:0:U', - 'DS:inform:DERIVE:600:0:U', - 'DS:nack:DERIVE:600:0:U', - 'DS:offer:DERIVE:600:0:U', - 'DS:other:DERIVE:600:0:U', - 'DS:release:DERIVE:600:0:U', - 'DS:request:DERIVE:600:0:U' -); +$rrd_def = RrdDefinition::make() + ->addDataset('ack', 'DERIVE', 0) + ->addDataset('decline', 'DERIVE', 0) + ->addDataset('discover', 'DERIVE', 0) + ->addDataset('inform', 'DERIVE', 0) + ->addDataset('nack', 'DERIVE', 0) + ->addDataset('offer', 'DERIVE', 0) + ->addDataset('other', 'DERIVE', 0) + ->addDataset('release', 'DERIVE', 0) + ->addDataset('request', 'DERIVE', 0); $fields = array( 'ack' => $data[0]['ibDhcpTotalNoOfAcks'], diff --git a/includes/polling/os/panos.inc.php b/includes/polling/os/panos.inc.php index 75ee068250..8f23d5b564 100644 --- a/includes/polling/os/panos.inc.php +++ b/includes/polling/os/panos.inc.php @@ -1,5 +1,7 @@ addDataset('sessions', 'GAUGE', 0, 3000000); $fields = array( 'sessions' => $sessions, @@ -23,7 +25,7 @@ if (is_numeric($sessions)) { $activetunnels = snmp_get($device, '1.3.6.1.4.1.25461.2.1.2.5.1.3.0', '-Ovq'); if (is_numeric($activetunnels)) { - $rrd_def = 'DS:activetunnels:GAUGE:600:0:3000000'; + $rrd_def = RrdDefinition::make()->addDataset('activetunnels', 'GAUGE', 0, 3000000); $fields = array( 'activetunnels' => $activetunnels, diff --git a/includes/polling/os/procurve.inc.php b/includes/polling/os/procurve.inc.php index 71509ea165..2feed52486 100644 --- a/includes/polling/os/procurve.inc.php +++ b/includes/polling/os/procurve.inc.php @@ -1,5 +1,7 @@ addDataset('value', 'GAUGE', -1, 100000); $fields = array( 'value' => $FdbAddressCount, diff --git a/includes/polling/os/pulse.inc.php b/includes/polling/os/pulse.inc.php index 330dbb0c17..e709dbc54c 100644 --- a/includes/polling/os/pulse.inc.php +++ b/includes/polling/os/pulse.inc.php @@ -10,6 +10,8 @@ * the source code distribution for details. */ +use LibreNMS\RRD\RrdDefinition; + $version = preg_replace('/[\r\n\"]+/', ' ', snmp_get($device, "productVersion.0", "-OQv", "PULSESECURE-PSG-MIB")); $hardware = "Juniper " . preg_replace('/[\r\n\"]+/', ' ', snmp_get($device, "productName.0", "-OQv", "PULSESECURE-PSG-MIB")); $hostname = trim($poll_device['sysName'], '"'); @@ -17,7 +19,7 @@ $hostname = trim($poll_device['sysName'], '"'); $users = snmp_get($device, 'iveConcurrentUsers.0', '-OQv', 'PULSESECURE-PSG-MIB'); if (is_numeric($users)) { - $rrd_def = 'DS:users:GAUGE:600:0:U'; + $rrd_def = RrdDefinition::make()->addDataset('users', 'GAUGE', 0); $fields = array( 'users' => $users, @@ -31,7 +33,7 @@ if (is_numeric($users)) { $sessions = snmp_get($device, 'iveConcurrentUsers.0', '-OQv', 'PULSESECURE-PSG-MIB'); if (is_numeric($sessions)) { - $rrd_def = 'DS:sessions:GAUGE:600:0:U'; + $rrd_def = RrdDefinition::make()->addDataset('sessions', 'GAUGE', 0); $fields = array( 'sessions' => $sessions, diff --git a/includes/polling/os/riverbed.inc.php b/includes/polling/os/riverbed.inc.php index 07ea13d2b4..c14fb6765b 100644 --- a/includes/polling/os/riverbed.inc.php +++ b/includes/polling/os/riverbed.inc.php @@ -10,6 +10,9 @@ * option) any later version. Please see LICENSE.txt at the top level of * the source code distribution for details. */ + +use LibreNMS\RRD\RrdDefinition; + $hardware = trim(snmp_get($device, '.1.3.6.1.4.1.17163.1.1.1.1.0', '-OQv'), '"'); $serial = trim(snmp_get($device, '.1.3.6.1.4.1.17163.1.1.1.2.0', '-OQv'), '"'); $version = trim(snmp_get($device, '.1.3.6.1.4.1.17163.1.1.1.3.0', '-OQv'), '"'); @@ -41,13 +44,12 @@ $conn_active = $connections['.1.3.6.1.4.1.17163.1.1.5.2.6.0']; $conn_total = $connections['.1.3.6.1.4.1.17163.1.1.5.2.7.0']; if ($conn_half_open >= 0 && $conn_half_closed >= 0 && $conn_established >= 0 && $conn_active >= 0 && $conn_total >= 0) { - $rrd_def = array( - 'DS:half_open:GAUGE:600:0:U', - 'DS:half_closed:GAUGE:600:0:U', - 'DS:established:GAUGE:600:0:U', - 'DS:active:GAUGE:600:0:U', - 'DS:total:GAUGE:600:0:U', - ); + $rrd_def = RrdDefinition::make() + ->addDataset('half_open', 'GAUGE', 0) + ->addDataset('half_closed', 'GAUGE', 0) + ->addDataset('established', 'GAUGE', 0) + ->addDataset('active', 'GAUGE', 0) + ->addDataset('total', 'GAUGE', 0); $fields = array( 'half_open' => $conn_half_open, @@ -79,10 +81,9 @@ $datastore_hits = $datastore['.1.3.6.1.4.1.17163.1.1.5.4.1.0']; $datastore_miss = $datastore['.1.3.6.1.4.1.17163.1.1.5.4.2.0']; if ($datastore_hits >= 0 && $datastore_miss >= 0) { - $rrd_def = array( - 'DS:datastore_hits:GAUGE:600:0:U', - 'DS:datastore_miss:GAUGE:600:0:U', - ); + $rrd_def = RrdDefinition::make() + ->addDataset('datastore_hits', 'GAUGE', 0) + ->addDataset('datastore_miss', 'GAUGE', 0); $fields = array( 'datastore_hits' => $datastore_hits, @@ -112,10 +113,9 @@ $conn_optimized = $optimizations['.1.3.6.1.4.1.17163.1.1.5.2.1.0']; $conn_passthrough = $optimizations['.1.3.6.1.4.1.17163.1.1.5.2.2.0']; if ($conn_optimized >= 0 && $conn_passthrough >= 0) { - $rrd_def = array( - 'DS:conn_optimized:GAUGE:600:0:U', - 'DS:conn_passthrough:GAUGE:600:0:U', - ); + $rrd_def = RrdDefinition::make() + ->addDataset('conn_optimized', 'GAUGE', 0) + ->addDataset('conn_passthrough', 'GAUGE', 0); $fields = array( 'conn_optimized' => $conn_optimized, @@ -149,11 +149,10 @@ $bw_out = $bandwidth['.1.3.6.1.4.1.17163.1.1.5.3.3.2.0']; $bw_total = $bandwidth['.1.3.6.1.4.1.17163.1.1.5.3.3.3.0']; if ($bw_in >= 0 && $bw_out >= 0 && $bw_total >= 0) { - $rrd_def = array( - 'DS:bw_in:COUNTER:600:0:U', - 'DS:bw_out:COUNTER:600:0:U', - 'DS:bw_total:COUNTER:600:0:U', - ); + $rrd_def = RrdDefinition::make() + ->addDataset('bw_in', 'COUNTER', 0) + ->addDataset('bw_out', 'COUNTER', 0) + ->addDataset('bw_total', 'COUNTER', 0); $fields = array( 'bw_in' => $bw_in, diff --git a/includes/polling/os/screenos.inc.php b/includes/polling/os/screenos.inc.php index c86b9b748a..e18c8ea70a 100644 --- a/includes/polling/os/screenos.inc.php +++ b/includes/polling/os/screenos.inc.php @@ -1,5 +1,7 @@ addDataset('allocate', 'GAUGE', 0, 3000000) + ->addDataset('max', 'GAUGE', 0, 3000000) + ->addDataset('failed', 'GAUGE', 0, 1000); $fields = array( 'allocate' => $sessalloc, diff --git a/includes/polling/os/sgos.inc.php b/includes/polling/os/sgos.inc.php index f939a568d7..eb7a4da675 100644 --- a/includes/polling/os/sgos.inc.php +++ b/includes/polling/os/sgos.inc.php @@ -1,11 +1,14 @@ addDataset('requests', 'GAUGE', 0); $fields = array( 'requests' => $sgos_requests ); diff --git a/includes/polling/os/snom.inc.php b/includes/polling/os/snom.inc.php index 444cf0c017..0e8618e2ab 100644 --- a/includes/polling/os/snom.inc.php +++ b/includes/polling/os/snom.inc.php @@ -1,5 +1,7 @@ addDataset('INOCTETS', 'COUNTER', null, 100000000000) + ->addDataset('OUTOCTETS', 'COUNTER', null, 10000000000) + ->addDataset('INPKTS', 'COUNTER', null, 10000000000) + ->addDataset('OUTPKTS', 'COUNTER', null, 10000000000) + ->addDataset('CALLS', 'COUNTER', null, 10000000000) + ->addDataset('REGISTRATIONS', 'COUNTER', null, 10000000000); $fields = array( 'INOCTETS' => $rxbytes, diff --git a/includes/polling/os/sonicwall.inc.php b/includes/polling/os/sonicwall.inc.php index 6fef5d0f21..6c6adfd938 100644 --- a/includes/polling/os/sonicwall.inc.php +++ b/includes/polling/os/sonicwall.inc.php @@ -9,6 +9,8 @@ // SNMPv2-SMI::enterprises.8741.2.1.1.3.0 = STRING: "SonicOS Enhanced 5.6.0.11-61o" // SNMPv2-SMI::enterprises.8741.2.1.1.4.0 = STRING: "5.0.2.11" +use LibreNMS\RRD\RrdDefinition; + $hardware = trim(snmp_get($device, '.1.3.6.1.4.1.8741.2.1.1.1.0', '-OQv', '', ''), '" '); $serial = trim(snmp_get($device, '.1.3.6.1.4.1.8741.2.1.1.2.0', '-OQv', '', ''), '" '); $fwversion = trim(snmp_get($device, '.1.3.6.1.4.1.8741.2.1.1.3.0', '-OQv', '', ''), '" '); @@ -18,10 +20,9 @@ $oids = 'sonicCurrentConnCacheEntries.0 sonicMaxConnCacheEntries.0'; $data = snmp_get_multi($device, $oids, '-OQUs', 'SONICWALL-FIREWALL-IP-STATISTICS-MIB'); if (is_numeric($data)) { - $rrd_def = array( - 'DS:activesessions:GAUGE:600:0:U', - 'DS:maxsessions:GAUGE:600:0:U', - ); + $rrd_def = RrdDefinition::make() + ->addDataset('activesessions', 'GAUGE', 0) + ->addDataset('maxsessions', 'GAUGE', 0); $fields = array( 'activesessions' => $data[0]['sonicCurrentConnCacheEntries'], 'maxsessions' => $data[0]['sonicMaxConnCacheEntries'], diff --git a/includes/polling/os/waas.inc.php b/includes/polling/os/waas.inc.php index 26ec3ae8be..eb2cab5374 100644 --- a/includes/polling/os/waas.inc.php +++ b/includes/polling/os/waas.inc.php @@ -10,6 +10,8 @@ * the source code distribution for details. */ +use LibreNMS\RRD\RrdDefinition; + $oids = 'entPhysicalContainedIn.1 entPhysicalSoftwareRev.1 entPhysicalSerialNum.1 entPhysicalModelName.1'; $data = snmp_get_multi($device, $oids, '-OQUs', 'ENTITY-MIB'); if ($data[1]['entPhysicalContainedIn'] == '0') { @@ -27,7 +29,7 @@ if ($data[1]['entPhysicalContainedIn'] == '0') { $connections = snmp_get($device, 'CISCO-WAN-OPTIMIZATION-MIB::cwoTfoStatsActiveOptConn.0', '-OQv'); if (is_numeric($connections)) { - $rrd_def = 'DS:connections:GAUGE:600:0:U'; + $rrd_def = RrdDefinition::make()->addDataset('connections', 'GAUGE', 0); $fields = array( 'connections' => $connections diff --git a/includes/polling/os/zywall.inc.php b/includes/polling/os/zywall.inc.php index 030b9b88e2..9e65ae77b8 100644 --- a/includes/polling/os/zywall.inc.php +++ b/includes/polling/os/zywall.inc.php @@ -1,5 +1,7 @@ addDataset('sessions', 'GAUGE', 0, 3000000); $fields = array( 'sessions' => $sessions, ); diff --git a/includes/polling/ospf.inc.php b/includes/polling/ospf.inc.php index 2b1355d24a..b4325b310d 100644 --- a/includes/polling/ospf.inc.php +++ b/includes/polling/ospf.inc.php @@ -1,5 +1,7 @@ addDataset('instances', 'GAUGE', 0, 1000000) + ->addDataset('areas', 'GAUGE', 0, 1000000) + ->addDataset('ports', 'GAUGE', 0, 1000000) + ->addDataset('neighbours', 'GAUGE', 0, 1000000); $fields = array( 'instances' => $ospf_instance_count, diff --git a/includes/polling/ports.inc.php b/includes/polling/ports.inc.php index aa418e447d..a6a23e8f58 100644 --- a/includes/polling/ports.inc.php +++ b/includes/polling/ports.inc.php @@ -1,6 +1,8 @@ addDataset('INOCTETS', 'DERIVE', 0, 12500000000) + ->addDataset('OUTOCTETS', 'DERIVE', 0, 12500000000) + ->addDataset('INERRORS', 'DERIVE', 0, 12500000000) + ->addDataset('OUTERRORS', 'DERIVE', 0, 12500000000) + ->addDataset('INUCASTPKTS', 'DERIVE', 0, 12500000000) + ->addDataset('OUTUCASTPKTS', 'DERIVE', 0, 12500000000) + ->addDataset('INNUCASTPKTS', 'DERIVE', 0, 12500000000) + ->addDataset('OUTNUCASTPKTS', 'DERIVE', 0, 12500000000) + ->addDataset('INDISCARDS', 'DERIVE', 0, 12500000000) + ->addDataset('OUTDISCARDS', 'DERIVE', 0, 12500000000) + ->addDataset('INUNKNOWNPROTOS', 'DERIVE', 0, 12500000000) + ->addDataset('INBROADCASTPKTS', 'DERIVE', 0, 12500000000) + ->addDataset('OUTBROADCASTPKTS', 'DERIVE', 0, 12500000000) + ->addDataset('INMULTICASTPKTS', 'DERIVE', 0, 12500000000) + ->addDataset('OUTMULTICASTPKTS', 'DERIVE', 0, 12500000000); $fields = array( 'INOCTETS' => $this_port['ifInOctets'], diff --git a/includes/polling/ports/port-adsl.inc.php b/includes/polling/ports/port-adsl.inc.php index 15847f4777..81b5fae361 100644 --- a/includes/polling/ports/port-adsl.inc.php +++ b/includes/polling/ports/port-adsl.inc.php @@ -1,5 +1,7 @@ addDataset('AtucCurrSnrMgn', 'GAUGE', 0, 635) + ->addDataset('AtucCurrAtn', 'GAUGE', 0, 635) + ->addDataset('AtucCurrOutputPwr', 'GAUGE', 0, 635) + ->addDataset('AtucCurrAttainableR', 'GAUGE', 0) + ->addDataset('AtucChanCurrTxRate', 'GAUGE', 0) + ->addDataset('AturCurrSnrMgn', 'GAUGE', 0, 635) + ->addDataset('AturCurrAtn', 'GAUGE', 0, 635) + ->addDataset('AturCurrOutputPwr', 'GAUGE', 0, 635) + ->addDataset('AturCurrAttainableR', 'GAUGE', 0) + ->addDataset('AturChanCurrTxRate', 'GAUGE', 0) + ->addDataset('AtucPerfLofs', 'COUNTER', null, 100000000000) + ->addDataset('AtucPerfLoss', 'COUNTER', null, 100000000000) + ->addDataset('AtucPerfLprs', 'COUNTER', null, 100000000000) + ->addDataset('AtucPerfESs', 'COUNTER', null, 100000000000) + ->addDataset('AtucPerfInits', 'COUNTER', null, 100000000000) + ->addDataset('AturPerfLofs', 'COUNTER', null, 100000000000) + ->addDataset('AturPerfLoss', 'COUNTER', null, 100000000000) + ->addDataset('AturPerfLprs', 'COUNTER', null, 100000000000) + ->addDataset('AturPerfESs', 'COUNTER', null, 100000000000) + ->addDataset('AtucChanCorrectedBl', 'COUNTER', null, 100000000000) + ->addDataset('AtucChanUncorrectBl', 'COUNTER', null, 100000000000) + ->addDataset('AturChanCorrectedBl', 'COUNTER', null, 100000000000) + ->addDataset('AturChanUncorrectBl', 'COUNTER', null, 100000000000); $adsl_oids = array( 'AtucCurrSnrMgn', diff --git a/includes/polling/ports/port-etherlike.inc.php b/includes/polling/ports/port-etherlike.inc.php index 2dc4397961..4b0309bf54 100644 --- a/includes/polling/ports/port-etherlike.inc.php +++ b/includes/polling/ports/port-etherlike.inc.php @@ -1,19 +1,18 @@ addDataset($oid_ds, 'COUNTER', null, 100000000000); + + $data = ($this_port[$oid] + 0); $fields[$oid] = $data; } diff --git a/includes/polling/ports/port-poe.inc.php b/includes/polling/ports/port-poe.inc.php index e832d2ca9a..f74db2df77 100644 --- a/includes/polling/ports/port-poe.inc.php +++ b/includes/polling/ports/port-poe.inc.php @@ -1,5 +1,7 @@ addDataset('PortPwrAllocated', 'GAUGE', 0) + ->addDataset('PortPwrAvailable', 'GAUGE', 0) + ->addDataset('PortConsumption', 'DERIVE', 0) + ->addDataset('PortMaxPwrDrawn', 'GAUGE', 0); $upd = "$polled:".$port['cpeExtPsePortPwrAllocated'].':'.$port['cpeExtPsePortPwrAvailable'].':'.$port['cpeExtPsePortPwrConsumption'].':'.$port['cpeExtPsePortMaxPwrDrawn']; diff --git a/includes/polling/processors.inc.php b/includes/polling/processors.inc.php index 04f7ce791d..68ebef4047 100644 --- a/includes/polling/processors.inc.php +++ b/includes/polling/processors.inc.php @@ -1,5 +1,7 @@ addDataset('usage', 'GAUGE', -273, 1000); $proc = trim(str_replace('"', '', $proc)); list($proc) = preg_split('@\ @', $proc); diff --git a/includes/polling/storage.inc.php b/includes/polling/storage.inc.php index 196416609b..3c34353dff 100644 --- a/includes/polling/storage.inc.php +++ b/includes/polling/storage.inc.php @@ -1,5 +1,7 @@ addDataset('used', 'GAUGE', 0) + ->addDataset('free', 'GAUGE', 0); $file = $config['install_dir'].'/includes/polling/storage/'. $mib .'.inc.php'; if (is_file($file)) { diff --git a/includes/polling/toner.inc.php b/includes/polling/toner.inc.php index 66002319a1..556bdd0f67 100644 --- a/includes/polling/toner.inc.php +++ b/includes/polling/toner.inc.php @@ -1,5 +1,7 @@ 'DS:toner:GAUGE:600:0:20000', + 'rrd_def' => RrdDefinition::make()->addDataset('toner', 'GAUGE', 0, 20000), 'rrd_name' => array('toner', $toner['toner_index']), 'rrd_oldname' => array('toner', $toner['toner_descr']), 'index' => $toner['toner_index'], diff --git a/includes/polling/ucd-diskio.inc.php b/includes/polling/ucd-diskio.inc.php index e5d5cd593f..cc913e5094 100644 --- a/includes/polling/ucd-diskio.inc.php +++ b/includes/polling/ucd-diskio.inc.php @@ -1,5 +1,7 @@ array('ucd_diskio', $diskio['diskio_descr']), - 'rrd_def' => array( - 'DS:read:DERIVE:600:0:125000000000', - 'DS:written:DERIVE:600:0:125000000000', - 'DS:reads:DERIVE:600:0:125000000000', - 'DS:writes:DERIVE:600:0:125000000000', - ), + 'rrd_def' => RrdDefinition::make() + ->addDataset('read', 'DERIVE', 0, 125000000000) + ->addDataset('written', 'DERIVE', 0, 125000000000) + ->addDataset('reads', 'DERIVE', 0, 125000000000) + ->addDataset('writes', 'DERIVE', 0, 125000000000), 'descr' => $diskio['diskio_descr'], ); diff --git a/includes/polling/ucd-mib.inc.php b/includes/polling/ucd-mib.inc.php index 005e1e243b..eeedc373b5 100644 --- a/includes/polling/ucd-mib.inc.php +++ b/includes/polling/ucd-mib.inc.php @@ -1,5 +1,7 @@ addDataset('user', 'COUNTER', 0) + ->addDataset('system', 'COUNTER', 0) + ->addDataset('nice', 'COUNTER', 0) + ->addDataset('idle', 'COUNTER', 0); $fields = array( 'user' => $ss['ssCpuRawUser'], @@ -71,7 +72,7 @@ $collect_oids = array( foreach ($collect_oids as $oid) { if (is_numeric($ss[$oid])) { $rrd_name = 'ucd_'.$oid; - $rrd_def = 'DS:value:COUNTER:600:0:U'; + $rrd_def = RrdDefinition::make()->addDataset('value', 'COUNTER', 0); $fields = array( 'value' => $ss[$oid], @@ -127,16 +128,15 @@ if (is_array($snmpdata[0])) { $snmpdata = $snmpdata[0]; if (is_numeric($memTotalReal) && is_numeric($memAvailReal) && is_numeric($memTotalFree)) { - $rrd_def = array( - 'DS:totalswap:GAUGE:600:0:10000000000', - 'DS:availswap:GAUGE:600:0:10000000000', - 'DS:totalreal:GAUGE:600:0:10000000000', - 'DS:availreal:GAUGE:600:0:10000000000', - 'DS:totalfree:GAUGE:600:0:10000000000', - 'DS:shared:GAUGE:600:0:10000000000', - 'DS:buffered:GAUGE:600:0:10000000000', - 'DS:cached:GAUGE:600:0:10000000000' - ); + $rrd_def = RrdDefinition::make() + ->addDataset('totalswap', 'GAUGE', 0, 10000000000) + ->addDataset('availswap', 'GAUGE', 0, 10000000000) + ->addDataset('totalreal', 'GAUGE', 0, 10000000000) + ->addDataset('availreal', 'GAUGE', 0, 10000000000) + ->addDataset('totalfree', 'GAUGE', 0, 10000000000) + ->addDataset('shared', 'GAUGE', 0, 10000000000) + ->addDataset('buffered', 'GAUGE', 0, 10000000000) + ->addDataset('cached', 'GAUGE', 0, 10000000000); $fields = array( 'totalswap' => $memTotalSwap, @@ -164,11 +164,10 @@ $load_raw = snmp_get_multi($device, 'laLoadInt.1 laLoadInt.2 laLoadInt.3', '-OQU // Check to see that the 5-min OID is actually populated before we make the rrd if (is_numeric($load_raw[2]['laLoadInt'])) { - $rrd_def = array( - 'DS:1min:GAUGE:600:0:5000', - 'DS:5min:GAUGE:600:0:5000', - 'DS:15min:GAUGE:600:0:5000' - ); + $rrd_def = RrdDefinition::make() + ->addDataset('1min', 'GAUGE', 0, 5000) + ->addDataset('5min', 'GAUGE', 0, 5000) + ->addDataset('15min', 'GAUGE', 0, 5000); $fields = array( '1min' => $load_raw[1]['laLoadInt'], diff --git a/includes/polling/unix-agent.inc.php b/includes/polling/unix-agent.inc.php index 9c935eb915..0eb0da1304 100644 --- a/includes/polling/unix-agent.inc.php +++ b/includes/polling/unix-agent.inc.php @@ -1,5 +1,7 @@ 'DS:time:GAUGE:600:0:U', + 'rrd_def' => RrdDefinition::make()->addDataset('time', 'GAUGE', 0), ); $fields = array( 'time' => $agent_time, diff --git a/includes/polling/unix-agent/munin-plugins.inc.php b/includes/polling/unix-agent/munin-plugins.inc.php index 2b9823f16b..f8818aa78c 100644 --- a/includes/polling/unix-agent/munin-plugins.inc.php +++ b/includes/polling/unix-agent/munin-plugins.inc.php @@ -1,6 +1,8 @@ $plugin_type, - 'rrd_def' => 'DS:val:' . $data['type'] . ':600:U:U', + 'rrd_def' => RrdDefinition::make()->addDataset('val', $data['type']), 'rrd_name' => $base_rrd_name . '_' . $name ); data_update($device, 'munin-plugins', $tags, $fields); diff --git a/includes/polling/wifi.inc.php b/includes/polling/wifi.inc.php index 7ee82df3e7..6ad57111d7 100644 --- a/includes/polling/wifi.inc.php +++ b/includes/polling/wifi.inc.php @@ -1,5 +1,7 @@ 'DS:wificlients:GAUGE:600:-273:1000', + 'rrd_def' => RrdDefinition::make()->addDataset('wificlients', 'GAUGE', -273, 1000), 'rrd_name' => array('wificlients', "radio$i"), 'radio' => $i, ); diff --git a/includes/polling/wireless/cambium-250.inc.php b/includes/polling/wireless/cambium-250.inc.php index 467f732f15..8035427aa7 100644 --- a/includes/polling/wireless/cambium-250.inc.php +++ b/includes/polling/wireless/cambium-250.inc.php @@ -9,9 +9,11 @@ * the source code distribution for details. */ +use LibreNMS\RRD\RrdDefinition; + $transmitPower = snmp_get($device, "transmitPower.0", "-Ovqn", "CAMBIUM-PTP250-MIB"); if (is_numeric($transmitPower)) { - $rrd_def = 'DS:transmitPower:GAUGE:600:0:100'; + $rrd_def = RrdDefinition::make()->addDataset('transmitPower', 'GAUGE', 0, 100); $fields = array( 'transmitPower' => $transmitPower / 10, ); @@ -24,10 +26,9 @@ if (is_numeric($transmitPower)) { $receivePower = snmp_get($device, "receivePower.0", "-Ovqn", "CAMBIUM-PTP250-MIB"); $noiseFloor = snmp_get($device, "noiseFloor.0", "-Ovqn", "CAMBIUM-PTP250-MIB"); if (is_numeric($receivePower)) { - $rrd_def = array( - 'DS:receivePower:GAUGE:600:-150:0', - 'DS:noiseFloor:GAUGE:600:-150:0' - ); + $rrd_def = RrdDefinition::make() + ->addDataset('receivePower', 'GAUGE', -150, 0) + ->addDataset('noiseFloor', 'GAUGE', -150, 0); $fields = array( 'receivePower' => $receivePower / 10, 'noiseFloor' => $noiseFloor, @@ -41,10 +42,9 @@ if (is_numeric($receivePower)) { $txModulation = snmp_get($device, ".1.3.6.1.4.1.17713.250.5.9.0", "-Ovqn", ""); $rxModulation = snmp_get($device, ".1.3.6.1.4.1.17713.250.5.8.0", "-Ovqn", ""); if (is_numeric($txModulation) && is_numeric($rxModulation)) { - $rrd_def = array( - 'DS:txModulation:GAUGE:600:0:24', - 'DS:rxModulation:GAUGE:600:0:24' - ); + $rrd_def = RrdDefinition::make() + ->addDataset('txModulation', 'GAUGE', 0, 24) + ->addDataset('rxModulation', 'GAUGE', 0, 24); $fields = array( 'txModuation' => $txModulation, 'rxModulation' => $rxModulation, @@ -59,11 +59,10 @@ $receiveDataRate = snmp_get($device, "receiveDataRate.0", "-Ovqn", "CAMBIUM-PTP2 $transmitDataRate = snmp_get($device, "transmitDataRate.0", "-Ovqn", "CAMBIUM-PTP250-MIB"); $aggregateDataRate = snmp_get($device, "aggregateDataRate.0", "-Ovqn", "CAMBIUM-PTP250-MIB"); if (is_numeric($receiveDataRate) && is_numeric($transmitDataRate) && is_numeric($aggregateDataRate)) { - $rrd_def = array( - 'DS:receiveDataRate:GAUGE:600:0:10000', - 'DS:transmitDataRate:GAUGE:600:0:10000', - 'DS:aggregateDataRate:GAUGE:600:0:10000' - ); + $rrd_def = RrdDefinition::make() + ->addDataset('receiveDataRate', 'GAUGE', 0, 10000) + ->addDataset('transmitDataRate', 'GAUGE', 0, 10000) + ->addDataset('aggregateDataRate', 'GAUGE', 0, 10000); $fields = array( 'receiveDataRate' => $receiveDataRate / 100, 'transmitDataRate' => $transmitDataRate / 100, @@ -77,7 +76,7 @@ if (is_numeric($receiveDataRate) && is_numeric($transmitDataRate) && is_numeric( $ssr = snmp_get($device, "signalStrengthRatio.0", "-Ovqn", "CAMBIUM-PTP250-MIB"); if (is_numeric($ssr)) { - $rrd_def = 'DS:ssr:GAUGE:600:-150:150'; + $rrd_def = RrdDefinition::make()->addDataset('ssr', 'GAUGE', -150, 150); $fields = array( 'ssr' => $ssr, ); diff --git a/includes/polling/wireless/cambium-650.inc.php b/includes/polling/wireless/cambium-650.inc.php index 9045dc0bb6..f3d80bbce2 100644 --- a/includes/polling/wireless/cambium-650.inc.php +++ b/includes/polling/wireless/cambium-650.inc.php @@ -9,9 +9,11 @@ * the source code distribution for details. */ +use LibreNMS\RRD\RrdDefinition; + $transmitPower = snmp_get($device, "transmitPower.0", "-Ovqn", "CAMBIUM-PTP650-MIB"); if (is_numeric($transmitPower)) { - $rrd_def = 'DS:transmitPower:GAUGE:600:0:100'; + $rrd_def = RrdDefinition::make()->addDataset('transmitPower', 'GAUGE', 0, 100); $fields = array( 'transmitPower' => $transmitPower / 10, ); @@ -22,7 +24,7 @@ if (is_numeric($transmitPower)) { $rawReceivePower = snmp_get($device, "rawReceivePower.0", "-Ovqn", "CAMBIUM-PTP650-MIB"); if (is_numeric($rawReceivePower)) { - $rrd_def = 'DS:rawReceivePower:GAUGE:600:-100:0'; + $rrd_def = RrdDefinition::make()->addDataset('rawReceivePower', 'GAUGE', -100, 0); $fields = array( 'rawReceivePower' => $rawReceivePower / 10, ); @@ -35,10 +37,9 @@ if (is_numeric($rawReceivePower)) { $txModulation = snmp_get($device, ".1.3.6.1.4.1.17713.7.12.15.0", "-Ovqn", ""); $rxModulation = snmp_get($device, ".1.3.6.1.4.1.17713.7.12.14.0", "-Ovqn", ""); if (is_numeric($txModulation) && is_numeric($rxModulation)) { - $rrd_def = array( - 'DS:txModulation:GAUGE:600:0:24', - 'DS:rxModulation:GAUGE:600:0:24' - ); + $rrd_def = RrdDefinition::make() + ->addDataset('txModulation', 'GAUGE', 0, 24) + ->addDataset('rxModulation', 'GAUGE', 0, 24); $fields = array( 'txModuation' => $txModulation, 'rxModulation' => $rxModulation, @@ -52,11 +53,10 @@ $receiveDataRate = snmp_get($device, "receiveDataRate.0", "-Ovqn", "CAMBIUM-PTP6 $transmitDataRate = snmp_get($device, "transmitDataRate.0", "-Ovqn", "CAMBIUM-PTP650-MIB"); $aggregateDataRate = snmp_get($device, "aggregateDataRate.0", "-Ovqn", "CAMBIUM-PTP650-MIB"); if (is_numeric($receiveDataRate) && is_numeric($transmitDataRate) && is_numeric($aggregateDataRate)) { - $rrd_def = array( - 'DS:receiveDataRate:GAUGE:600:0:10000', - 'DS:transmitDataRate:GAUGE:600:0:10000', - 'DS:aggregateDataRate:GAUGE:600:0:10000' - ); + $rrd_def = RrdDefinition::make() + ->addDataset('receiveDataRate', 'GAUGE', 0, 10000) + ->addDataset('transmitDataRate', 'GAUGE', 0, 10000) + ->addDataset('aggregateDataRate', 'GAUGE', 0, 10000); $fields = array( 'receiveDataRate' => $receiveDataRate / 100, 'transmitDataRate' => $transmitDataRate / 100, @@ -69,7 +69,7 @@ if (is_numeric($receiveDataRate) && is_numeric($transmitDataRate) && is_numeric( $ssr = snmp_get($device, "signalStrengthRatio.0", "-Ovqn", "CAMBIUM-PTP650-MIB"); if (is_numeric($ssr)) { - $rrd_def = 'DS:ssr:GAUGE:600:-150:150'; + $rrd_def = RrdDefinition::make()->addDataset('ssr', 'GAUGE', -150, 150); $fields = array( 'ssr' => $ssr, ); @@ -101,7 +101,7 @@ if ($gps == 'locked') { $gps = 9; } if (is_numeric($gps)) { - $rrd_def = 'DS:gps:GAUGE:600:0:10'; + $rrd_def = RrdDefinition::make()->addDataset('gps', 'GAUGE', 0, 10); $fields = array( 'gps' => $gps, ); diff --git a/includes/polling/wireless/cambium-epmp.inc.php b/includes/polling/wireless/cambium-epmp.inc.php index 18b73ec2a9..fa11c9b2a1 100644 --- a/includes/polling/wireless/cambium-epmp.inc.php +++ b/includes/polling/wireless/cambium-epmp.inc.php @@ -6,13 +6,14 @@ * option) any later version. Please see LICENSE.txt at the top level of * the source code distribution for details. */ +use LibreNMS\RRD\RrdDefinition; + $cambiumSTADLRSSI = snmp_get($device, "cambiumSTADLRSSI.0", "-Ovqn", "CAMBIUM-PMP80211-MIB"); $cambiumSTADLSNR = snmp_get($device, "cambiumSTADLSNR.0", "-Ovqn", "CAMBIUM-PMP80211-MIB"); if (is_numeric($cambiumSTADLRSSI) && is_numeric($cambiumSTADLSNR)) { - $rrd_def = array( - 'DS:cambiumSTADLRSSI:GAUGE:600:-150:0', - 'DS:cambiumSTADLSNR:GAUGE:600:0:150' - ); + $rrd_def = RrdDefinition::make() + ->addDataset('cambiumSTADLRSSI', 'GAUGE', -150, 0) + ->addDataset('cambiumSTADLSNR', 'GAUGE', 0, 150); $fields = array( 'cambiumSTADLRSSI' => $cambiumSTADLRSSI, 'cambiumSTADLSNR' => $cambiumSTADLSNR @@ -25,10 +26,9 @@ if (is_numeric($cambiumSTADLRSSI) && is_numeric($cambiumSTADLSNR)) { $cambiumGPSNumTrackedSat = snmp_get($device, "cambiumGPSNumTrackedSat.0", "-Ovqn", "CAMBIUM-PMP80211-MIB"); $cambiumGPSNumVisibleSat = snmp_get($device, "cambiumGPSNumVisibleSat.0", "-Ovqn", "CAMBIUM-PMP80211-MIB"); if (is_numeric($cambiumGPSNumTrackedSat) && is_numeric($cambiumGPSNumVisibleSat)) { - $rrd_def = array( - 'DS:numTracked:GAUGE:600:0:100000', - 'DS:numVisible:GAUGE:600:0:100000' - ); + $rrd_def = RrdDefinition::make() + ->addDataset('numTracked', 'GAUGE', 0, 100000) + ->addDataset('numVisible', 'GAUGE', 0, 100000); $fields = array( 'numTracked' => $cambiumGPSNumTrackedSat, 'numVisible' => $cambiumGPSNumVisibleSat @@ -41,10 +41,9 @@ if (is_numeric($cambiumGPSNumTrackedSat) && is_numeric($cambiumGPSNumVisibleSat) $cambiumSTAUplinkMCSMode = snmp_get($device, "cambiumSTAUplinkMCSMode.0", "-Ovqn", "CAMBIUM-PMP80211-MIB"); $cambiumSTADownlinkMCSMode = snmp_get($device, "cambiumSTADownlinkMCSMode.0", "-Ovqn", "CAMBIUM-PMP80211-MIB"); if (is_numeric($cambiumSTAUplinkMCSMode) && is_numeric($cambiumSTADownlinkMCSMode)) { - $rrd_def = array( - 'DS:uplinkMCSMode:GAUGE:600:-30:30', - 'DS:downlinkMCSMode:GAUGE:600:-30:30' - ); + $rrd_def = RrdDefinition::make() + ->addDataset('uplinkMCSMode', 'GAUGE', -30, 30) + ->addDataset('downlinkMCSMode', 'GAUGE', -30, 30); $fields = array( 'uplinkMCSMode' => $cambiumSTAUplinkMCSMode, 'downlinkMCSMode' => $cambiumSTADownlinkMCSMode @@ -56,7 +55,7 @@ if (is_numeric($cambiumSTAUplinkMCSMode) && is_numeric($cambiumSTADownlinkMCSMod $registeredSM = snmp_get($device, "cambiumAPNumberOfConnectedSTA.0", "-Ovqn", "CAMBIUM-PMP80211-MIB"); if (is_numeric($registeredSM)) { - $rrd_def = 'DS:regSM:GAUGE:600:0:10000'; + $rrd_def = RrdDefinition::make()->addDataset('regSM', 'GAUGE', 0, 10000); $fields = array( 'regSM' => $registeredSM, ); @@ -69,11 +68,10 @@ $sysNetworkEntryAttempt = snmp_get($device, "sysNetworkEntryAttempt.0", "-Ovqn", $sysNetworkEntrySuccess = snmp_get($device, "sysNetworkEntrySuccess.0", "-Ovqn", "CAMBIUM-PMP80211-MIB"); $sysNetworkEntryAuthenticationFailure = snmp_get($device, "sysNetworkEntryAuthenticationFailure.0", "-Ovqn", "CAMBIUM-PMP80211-MIB"); if (is_numeric($sysNetworkEntryAttempt) && is_numeric($sysNetworkEntrySuccess) && is_numeric($sysNetworkEntryAuthenticationFailure)) { - $rrd_def = array( - 'DS:entryAttempt:GAUGE:600:0:100000', - 'DS:entryAccess:GAUGE:600:0:100000', - 'DS:authFailure:GAUGE:600:0:100000' - ); + $rrd_def = RrdDefinition::make() + ->addDataset('entryAttempt', 'GAUGE', 0, 100000) + ->addDataset('entryAccess', 'GAUGE', 0, 100000) + ->addDataset('authFailure', 'GAUGE', 0, 100000); $fields = array( 'entryAttempt' => $sysNetworkEntryAttempt, 'entryAccess' => $sysNetworkEntrySuccess, @@ -86,7 +84,7 @@ if (is_numeric($sysNetworkEntryAttempt) && is_numeric($sysNetworkEntrySuccess) & $gpsSync = snmp_get($device, "cambiumEffectiveSyncSource.0", "-Ovqn", "CAMBIUM-PMP80211-MIB"); if (is_numeric($gpsSync)) { - $rrd_def = 'DS:gpsSync:GAUGE:600:0:4'; + $rrd_def = RrdDefinition::make()->addDataset('gpsSync', 'GAUGE', 0, 4); $fields = array( 'gpsSync' => $gpsSync, ); @@ -97,7 +95,7 @@ if (is_numeric($gpsSync)) { $freq = snmp_get($device, "cambiumSTAConnectedRFFrequency.0", "-Ovqn", "CAMBIUM-PMP80211-MIB"); if (is_numeric($freq)) { - $rrd_def = 'DS:freq:GAUGE:600:0:100000'; + $rrd_def = RrdDefinition::make()->addDataset('freq', 'GAUGE', 0, 100000); $fields = array( 'freq' => $freq, ); @@ -118,10 +116,9 @@ if (is_numeric($ulWLanTotalAvailableFrameTimePerSecond) && is_numeric($ulWLanTot $dlWlanFrameUtilization = round((($dlWLanTotalUsedFrameTimePerSecond/$dlWLanTotalAvailableFrameTimePerSecond)*100), 2); d_echo($dlWlanFrameUtilization); d_echo($ulWlanFrameUtilization); - $rrd_def = array( - 'DS:ulwlanfrut:GAUGE:600:0:100000', - 'DS:dlwlanfrut:GAUGE:600:0:100000' - ); + $rrd_def = RrdDefinition::make() + ->addDataset('ulwlanfrut', 'GAUGE', 0, 100000) + ->addDataset('dlwlanfrut', 'GAUGE', 0, 100000); $fields = array( 'ulwlanframeutilization' => $ulWlanFrameUtilization, 'dlwlanframeutilization' => $dlWlanFrameUtilization diff --git a/includes/polling/wireless/cambium-generic.inc.php b/includes/polling/wireless/cambium-generic.inc.php index 63c21f70f4..44c6b2ff71 100644 --- a/includes/polling/wireless/cambium-generic.inc.php +++ b/includes/polling/wireless/cambium-generic.inc.php @@ -8,14 +8,15 @@ * option) any later version. Please see LICENSE.txt at the top level of * the source code distribution for details. */ +use LibreNMS\RRD\RrdDefinition; + if (strstr($hardware, 'CMM') == false) { $fecInErrorsCount = snmp_get($device, "fecInErrorsCount.0", "-Ovqn", "WHISP-BOX-MIBV2-MIB"); $fecOutErrorsCount = snmp_get($device, "fecOutErrorsCount.0", "-Ovqn", "WHISP-BOX-MIBV2-MIB"); if (is_numeric($fecInErrorsCount) && is_numeric($fecOutErrorsCount)) { - $rrd_def = array( - 'DS:fecInErrorsCount:GAUGE:600:0:100000', - 'DS:fecOutErrorsCount:GAUGE:600:0:100000' - ); + $rrd_def = RrdDefinition::make() + ->addDataset('fecInErrorsCount', 'GAUGE', 0, 100000) + ->addDataset('fecOutErrorsCount', 'GAUGE', 0, 100000); $fields = array( 'fecInErrorsCount' => $fecInErrorsCount, 'fecOutErrorsCount' => $fecOutErrorsCount, @@ -23,12 +24,12 @@ if (strstr($hardware, 'CMM') == false) { $tags = compact('rrd_def'); data_update($device, 'cambium-generic-errorCount', $tags, $fields); $graphs['cambium_generic_errorCount'] = true; - unset($rrd_filename,$fecInErrorsCount,$fecOutErrorsCount); + unset($rrd_filename, $fecInErrorsCount, $fecOutErrorsCount); } $crcErrors = snmp_get($device, "fecCRCError.0", "-Ovqn", "WHISP-BOX-MIBV2-MIB"); if (is_numeric($crcErrors)) { - $rrd_def = 'DS:crcErrors:GAUGE:600:0:100000'; + $rrd_def = RrdDefinition::make()->addDataset('crcErrors', 'GAUGE', 0, 100000); $fields = array( 'crcErrors' => $crcErrors, ); @@ -41,11 +42,10 @@ if (strstr($hardware, 'CMM') == false) { $horizontal = str_replace('"', "", snmp_get($device, ".1.3.6.1.4.1.161.19.3.2.2.118.0", "-Ovqn", "")); $combined = snmp_get($device, "1.3.6.1.4.1.161.19.3.2.2.21.0", "-Ovqn", ""); if (is_numeric($vertical) && is_numeric($horizontal) && is_numeric($combined)) { - $rrd_def = array( - 'DS:vertical:GAUGE:600:-150:0', - 'DS:horizontal:GAUGE:600:-150:0', - 'DS:combined:GAUGE:600:-150:0' - ); + $rrd_def = RrdDefinition::make() + ->addDataset('vertical', 'GAUGE', -150, 0) + ->addDataset('horizontal', 'GAUGE', -150, 0) + ->addDataset('combined', 'GAUGE', -150, 0); $fields = array( 'vertical' => floatval($vertical), 'horizontal' => floatval($horizontal), @@ -59,7 +59,7 @@ if (strstr($hardware, 'CMM') == false) { $rssi = snmp_get($device, "1.3.6.1.4.1.161.19.3.2.2.2.0", "-Ovqn", ""); if (is_numeric($rssi)) { - $rrd_def = 'DS:rssi:GAUGE:600:0:5000'; + $rrd_def = RrdDefinition::make()->addDataset('rssi', 'GAUGE', 0, 5000); $fields = array( 'rssi' => $rssi, ); @@ -71,7 +71,7 @@ if (strstr($hardware, 'CMM') == false) { $jitter = snmp_get($device, "jitter.0", "-Ovqn", "WHISP-SM-MIB"); if (is_numeric($jitter)) { - $rrd_def = 'DS:jitter:GAUGE:600:0:20'; + $rrd_def = RrdDefinition::make()->addDataset('jitter', 'GAUGE', 0, 20); $fields = array( 'jitter' => $jitter, ); @@ -84,10 +84,9 @@ if (strstr($hardware, 'CMM') == false) { $horizontal = str_replace('"', "", snmp_get($device, "radioDbmHorizontal.0", "-Ovqn", "WHISP-SM-MIB")); $vertical = str_replace('"', "", snmp_get($device, "radioDbmVertical.0", "-Ovqn", "WHISP-SM-MIB")); if (is_numeric($horizontal) && is_numeric($vertical)) { - $rrd_def = array( - 'DS:horizontal:GAUGE:600:-100:100', - 'DS:vertical:GAUGE:600:-100:100' - ); + $rrd_def = RrdDefinition::make() + ->addDataset('horizontal', 'GAUGE', -100, 100) + ->addDataset('vertical', 'GAUGE', -100, 100); $fields = array( 'horizontal' => $horizontal, 'vertical' => $vertical, @@ -100,7 +99,7 @@ if (strstr($hardware, 'CMM') == false) { $ssr = str_replace('"', "", snmp_get($device, "signalStrengthRatio.0", "-Ovqn", "WHISP-SM-MIB")); if (is_numeric($ssr)) { - $rrd_def = 'DS:ssr:GAUGE:600:-150:150'; + $rrd_def = RrdDefinition::make()->addDataset('ssr', 'GAUGE', -150, 150); $fields = array( 'ssr' => $ssr, ); @@ -113,10 +112,9 @@ if (strstr($hardware, 'CMM') == false) { $horizontal = str_replace('"', "", snmp_get($device, "signalToNoiseRatioSMHorizontal.0", "-Ovqn", "WHISP-SM-MIB")); $vertical = str_replace('"', "", snmp_get($device, "signalToNoiseRatioSMVertical.0", "-Ovqn", "WHISP-SM-MIB")); if (is_numeric($horizontal) && is_numeric($vertical)) { - $rrd_def = array( - 'DS:horizontal:GAUGE:600:0:100', - 'DS:vertical:GAUGE:600:0:100' - ); + $rrd_def = RrdDefinition::make() + ->addDataset('horizontal', 'GAUGE', 0, 100) + ->addDataset('vertical', 'GAUGE', 0, 100); $fields = array( 'horizontal' => $horizontal, 'vertical' => $vertical, @@ -138,7 +136,7 @@ if (strstr($hardware, 'AP') || strstr($hardware, 'Master') || strstr($hardware, $gpsStatus = 1; } if (is_numeric($gpsStatus)) { - $rrd_def = 'DS:whispGPSStats:GAUGE:600:0:4'; + $rrd_def = RrdDefinition::make()->addDataset('whispGPSStats', 'GAUGE', 0, 4); $fields = array( 'whispGPSStats' => $gpsStatus, ); @@ -151,10 +149,9 @@ if (strstr($hardware, 'AP') || strstr($hardware, 'Master') || strstr($hardware, $visible = str_replace('"', "", snmp_get($device, ".1.3.6.1.4.1.161.19.3.4.4.7.0", "-Ovqn", "")); $tracked = str_replace('"', "", snmp_get($device, ".1.3.6.1.4.1.161.19.3.4.4.8.0", "-Ovqn", "")); if (is_numeric($visible) && is_numeric($tracked)) { - $rrd_def = array( - 'DS:visible:GAUGE:600:0:1000', - 'DS:tracked:GAUGE:600:0:1000' - ); + $rrd_def = RrdDefinition::make() + ->addDataset('visible', 'GAUGE', 0, 1000) + ->addDataset('tracked', 'GAUGE', 0, 1000); $fields = array( 'visible' => floatval($visible), 'tracked' => floatval($tracked), @@ -168,7 +165,7 @@ if (strstr($hardware, 'AP') || strstr($hardware, 'Master') || strstr($hardware, //PTP Equipment $lastLevel = str_replace('"', "", snmp_get($device, "lastPowerLevel.2", "-Ovqn", "WHISP-APS-MIB")); if (is_numeric($lastLevel)) { - $rrd_def = 'DS:last:GAUGE:600:-100:0'; + $rrd_def = RrdDefinition::make()->addDataset('last', 'GAUGE', -100, 0); $fields = array( 'last' => $lastLevel, ); @@ -182,10 +179,9 @@ if (strstr($version, 'AP') == false) { $horizontal = str_replace('"', "", snmp_get($device, "linkRadioDbmHorizontal.2", "-Ovqn", "WHISP-APS-MIB")); $vertical = str_replace('"', "", snmp_get($device, "linkRadioDbmVertical.2", "-Ovqn", "WHISP-APS-MIB")); if (is_numeric($horizontal) && is_numeric($vertical)) { - $rrd_def = array( - 'DS:horizontal:GAUGE:600:-100:0', - 'DS:vertical:GAUGE:600:-100:0' - ); + $rrd_def = RrdDefinition::make() + ->addDataset('horizontal', 'GAUGE', -100, 0) + ->addDataset('vertical', 'GAUGE', -100, 0); $fields = array( 'horizontal' => $horizontal, 'vertical' => $vertical, @@ -199,10 +195,9 @@ if (strstr($version, 'AP') == false) { $horizontal = str_replace('"', "", snmp_get($device, "signalToNoiseRatioHorizontal.2", "-Ovqn", "WHISP-APS-MIB")); $vertical = str_replace('"', "", snmp_get($device, "signalToNoiseRatioVertical.2", "-Ovqn", "WHISP-APS-MIB")); if (is_numeric($horizontal) && is_numeric($vertical)) { - $rrd_def = array( - 'DS:horizontal:GAUGE:600:0:100', - 'DS:vertical:GAUGE:600:0:100' - ); + $rrd_def = RrdDefinition::make() + ->addDataset('horizontal', 'GAUGE', 0, 100) + ->addDataset('vertical', 'GAUGE', 0, 100); $fields = array( 'horizontal' => $horizontal, 'vertical' => $vertical, @@ -215,7 +210,7 @@ if (strstr($version, 'AP') == false) { $ssr = str_replace('"', "", snmp_get($device, "linkSignalStrengthRatio.2", "-Ovqn", "WHISP-APS-MIB")); if (is_numeric($ssr)) { - $rrd_def = 'DS:ssr:GAUGE:600:-150:150'; + $rrd_def = RrdDefinition::make()->addDataset('ssr', 'GAUGE', -150, 150); $fields = array( 'ssr' => $ssr, ); @@ -232,12 +227,11 @@ if (strstr($version, 'AP') == false) { $avgRadio = str_replace('"', "", snmp_get($device, "radioDbmAvg.0", "-Ovqn", "WHISP-SM-MIB")); if (is_numeric($dbmRadio) && is_numeric($minRadio) && is_numeric($maxRadio) && is_numeric($avgRadio)) { - $rrd_def = array( - 'DS:dbm:GAUGE:600:-100:0', - 'DS:min:GAUGE:600:-100:0', - 'DS:max:GAUGE:600:-100:0', - 'DS:avg:GAUGE:600:-100:0' - ); + $rrd_def = RrdDefinition::make() + ->addDataset('dbm', 'GAUGE', -100, 0) + ->addDataset('min', 'GAUGE', -100, 0) + ->addDataset('max', 'GAUGE', -100, 0) + ->addDataset('avg', 'GAUGE', -100, 0); $fields = array( 'dbm' => $dbmRadio, 'min' => $minRadio, @@ -257,10 +251,9 @@ if (strstr($version, 'AP')) { $registered = str_replace('"', "", snmp_get($device, "regCount.0", "-Ovqn", "WHISP-APS-MIB")); $failed = str_replace('"', "", snmp_get($device, "regFailureCount.0", "-Ovqn", "WHISP-APS-MIB")); if (is_numeric($registered) && is_numeric($failed)) { - $rrd_def = array( - 'DS:regCount:GAUGE:600:0:15000', - 'DS:failed:GAUGE:600:0:15000' - ); + $rrd_def = RrdDefinition::make() + ->addDataset('regCount', 'GAUGE', 0, 15000) + ->addDataset('failed', 'GAUGE', 0, 15000); $fields = array( 'regCount' => $registered, 'failed' => $failed, @@ -273,7 +266,7 @@ if (strstr($version, 'AP')) { $freq = str_replace('"', "", snmp_get($device, "currentRadioFreqCarrier.0", "-Ovqn", "WHISP-APS-MIB")); if (is_numeric($freq)) { - $rrd_def = 'DS:freq:GAUGE:600:0:100000'; + $rrd_def = RrdDefinition::make()->addDataset('freq', 'GAUGE', 0, 100000); if ($freq > 99999) { $freq = $freq / 100000; } else { diff --git a/includes/polling/wireless/canopy-generic.inc.php b/includes/polling/wireless/canopy-generic.inc.php index f004dca7d0..956b662b6d 100644 --- a/includes/polling/wireless/canopy-generic.inc.php +++ b/includes/polling/wireless/canopy-generic.inc.php @@ -8,14 +8,15 @@ * option) any later version. Please see LICENSE.txt at the top level of * the source code distribution for details. */ +use LibreNMS\RRD\RrdDefinition; + if (strstr($hardware, 'CMM') == false) { $fecInErrorsCount = snmp_get($device, "fecInErrorsCount.0", "-Ovqn", "WHISP-BOX-MIBV2-MIB"); $fecOutErrorsCount = snmp_get($device, "fecOutErrorsCount.0", "-Ovqn", "WHISP-BOX-MIBV2-MIB"); if (is_numeric($fecInErrorsCount) && is_numeric($fecOutErrorsCount)) { - $rrd_def = array( - 'DS:fecInErrorsCount:GAUGE:600:0:100000', - 'DS:fecOutErrorsCount:GAUGE:600:0:100000' - ); + $rrd_def = RrdDefinition::make() + ->addDataset('fecInErrorsCount', 'GAUGE', 0, 100000) + ->addDataset('fecOutErrorsCount', 'GAUGE', 0, 100000); $fields = array( 'fecInErrorsCount' => $fecInErrorsCount, @@ -29,7 +30,7 @@ if (strstr($hardware, 'CMM') == false) { $crcErrors = snmp_get($device, "fecCRCError.0", "-Ovqn", "WHISP-BOX-MIBV2-MIB"); if (is_numeric($crcErrors)) { - $rrd_def = 'DS:crcErrors:GAUGE:600:0:100000'; + $rrd_def = RrdDefinition::make()->addDataset('crcErrors', 'GAUGE', 0, 100000); $fields = array( 'crcErrors' => $crcErrors, ); @@ -42,11 +43,10 @@ if (strstr($hardware, 'CMM') == false) { $horizontal = str_replace('"', "", snmp_get($device, ".1.3.6.1.4.1.161.19.3.2.2.118.0", "-Ovqn", "")); $combined = snmp_get($device, "1.3.6.1.4.1.161.19.3.2.2.21.0", "-Ovqn", ""); if (is_numeric($vertical) && is_numeric($horizontal) && is_numeric($combined)) { - $rrd_def = array( - 'DS:vertical:GAUGE:600:-150:0', - 'DS:horizontal:GAUGE:600:-150:0', - 'DS:combined:GAUGE:600:-150:0' - ); + $rrd_def = RrdDefinition::make() + ->addDataset('vertical', 'GAUGE', -150, 0) + ->addDataset('horizontal', 'GAUGE', -150, 0) + ->addDataset('combined', 'GAUGE', -150, 0); $fields = array( 'vertical' => floatval($vertical), 'horizontal' => floatval($horizontal), @@ -60,7 +60,7 @@ if (strstr($hardware, 'CMM') == false) { $rssi = snmp_get($device, "1.3.6.1.4.1.161.19.3.2.2.2.0", "-Ovqn", ""); if (is_numeric($rssi)) { - $rrd_def = 'DS:rssi:GAUGE:600:0:5000'; + $rrd_def = RrdDefinition::make()->addDataset('rssi', 'GAUGE', 0, 5000); $fields = array( 'rssi' => $rssi, ); @@ -72,7 +72,7 @@ if (strstr($hardware, 'CMM') == false) { $jitter = snmp_get($device, "jitter.0", "-Ovqn", "WHISP-SM-MIB"); if (is_numeric($jitter)) { - $rrd_def = 'DS:jitter:GAUGE:600:0:20'; + $rrd_def = RrdDefinition::make()->addDataset('jitter', 'GAUGE', 0, 20); $fields = array( 'jitter' => $jitter, ); @@ -85,10 +85,9 @@ if (strstr($hardware, 'CMM') == false) { $horizontal = str_replace('"', "", snmp_get($device, "radioDbmHorizontal.0", "-Ovqn", "WHISP-SM-MIB")); $vertical = str_replace('"', "", snmp_get($device, "radioDbmVertical.0", "-Ovqn", "WHISP-SM-MIB")); if (is_numeric($horizontal) && is_numeric($vertical)) { - $rrd_def = array( - 'DS:horizontal:GAUGE:600:-100:100', - 'DS:vertical:GAUGE:600:-100:100' - ); + $rrd_def = RrdDefinition::make() + ->addDataset('horizontal', 'GAUGE', -100, 100) + ->addDataset('vertical', 'GAUGE', -100, 100); $fields = array( 'horizontal' => $horizontal, @@ -102,7 +101,7 @@ if (strstr($hardware, 'CMM') == false) { $ssr = str_replace('"', "", snmp_get($device, "signalStrengthRatio.0", "-Ovqn", "WHISP-SM-MIB")); if (is_numeric($ssr)) { - $rrd_def = 'DS:ssr:GAUGE:600:-150:150'; + $rrd_def = RrdDefinition::make()->addDataset('ssr', 'GAUGE', -150, 150); $fields = array( 'ssr' => $ssr, ); @@ -115,10 +114,9 @@ if (strstr($hardware, 'CMM') == false) { $horizontal = str_replace('"', "", snmp_get($device, "signalToNoiseRatioSMHorizontal.0", "-Ovqn", "WHISP-SM-MIB")); $vertical = str_replace('"', "", snmp_get($device, "signalToNoiseRatioSMVertical.0", "-Ovqn", "WHISP-SM-MIB")); if (is_numeric($horizontal) && is_numeric($vertical)) { - $rrd_def = array( - 'DS:horizontal:GAUGE:600:0:100', - 'DS:vertical:GAUGE:600:0:100' - ); + $rrd_def = RrdDefinition::make() + ->addDataset('horizontal', 'GAUGE', 0, 100) + ->addDataset('vertical', 'GAUGE', 0, 100); $fields = array( 'horizontal' => $horizontal, 'vertical' => $vertical, @@ -140,7 +138,7 @@ if (strstr($hardware, 'AP') || strstr($hardware, 'Master') || strstr($hardware, $gpsStatus = 1; } if (is_numeric($gpsStatus)) { - $rrd_def = 'DS:whispGPSStats:GAUGE:600:0:4'; + $rrd_def = RrdDefinition::make()->addDataset('whispGPSStats', 'GAUGE', 0, 4); $fields = array( 'whispGPSStats' => $gpsStatus, ); @@ -153,10 +151,9 @@ if (strstr($hardware, 'AP') || strstr($hardware, 'Master') || strstr($hardware, $visible = str_replace('"', "", snmp_get($device, ".1.3.6.1.4.1.161.19.3.4.4.7.0", "-Ovqn", "")); $tracked = str_replace('"', "", snmp_get($device, ".1.3.6.1.4.1.161.19.3.4.4.8.0", "-Ovqn", "")); if (is_numeric($visible) && is_numeric($tracked)) { - $rrd_def = array( - 'DS:visible:GAUGE:600:0:1000', - 'DS:tracked:GAUGE:600:0:1000' - ); + $rrd_def = RrdDefinition::make() + ->addDataset('visible', 'GAUGE', 0, 1000) + ->addDataset('tracked', 'GAUGE', 0, 1000); $fields = array( 'visible' => floatval($visible), 'tracked' => floatval($tracked), @@ -172,10 +169,9 @@ if (strstr($version, 'AP') == false) { $horizontal = str_replace('"', "", snmp_get($device, "linkRadioDbmHorizontal.2", "-Ovqn", "WHISP-APS-MIB")); $vertical = str_replace('"', "", snmp_get($device, "linkRadioDbmVertical.2", "-Ovqn", "WHISP-APS-MIB")); if (is_numeric($horizontal) && is_numeric($vertical)) { - $rrd_def = array( - 'DS:horizontal:GAUGE:600:-100:0', - 'DS:vertical:GAUGE:600:-100:0' - ); + $rrd_def = RrdDefinition::make() + ->addDataset('horizontal', 'GAUGE', -100, 0) + ->addDataset('vertical', 'GAUGE', -100, 0); $fields = array( 'horizontal' => $horizontal, 'vertical' => $vertical, @@ -188,7 +184,7 @@ if (strstr($version, 'AP') == false) { $lastLevel = str_replace('"', "", snmp_get($device, "lastPowerLevel.2", "-Ovqn", "WHISP-APS-MIB")); if (is_numeric($lastLevel)) { - $rrd_def = 'DS:last:GAUGE:600:-100:0'; + $rrd_def = RrdDefinition::make()->addDataset('last', 'GAUGE', -100, 0); $fields = array( 'last' => $lastLevel, ); @@ -201,10 +197,9 @@ if (strstr($version, 'AP') == false) { $horizontal = str_replace('"', "", snmp_get($device, "signalToNoiseRatioHorizontal.2", "-Ovqn", "WHISP-APS-MIB")); $vertical = str_replace('"', "", snmp_get($device, "signalToNoiseRatioVertical.2", "-Ovqn", "WHISP-APS-MIB")); if (is_numeric($horizontal) && is_numeric($vertical)) { - $rrd_def = array( - 'DS:horizontal:GAUGE:600:0:100', - 'DS:vertical:GAUGE:600:0:100' - ); + $rrd_def = RrdDefinition::make() + ->addDataset('horizontal', 'GAUGE', 0, 100) + ->addDataset('vertical', 'GAUGE', 0, 100); $fields = array( 'horizontal' => $horizontal, 'vertical' => $vertical, @@ -217,7 +212,7 @@ if (strstr($version, 'AP') == false) { $ssr = str_replace('"', "", snmp_get($device, "linkSignalStrengthRatio.2", "-Ovqn", "WHISP-APS-MIB")); if (is_numeric($ssr)) { - $rrd_def = 'DS:ssr:GAUGE:600:-150:150'; + $rrd_def = RrdDefinition::make()->addDataset('ssr', 'GAUGE', -150, 150); $fields = array( 'ssr' => $ssr, ); @@ -234,12 +229,11 @@ if (strstr($version, 'AP') == false) { $avgRadio = str_replace('"', "", snmp_get($device, "radioDbmAvg.0", "-Ovqn", "WHISP-SM-MIB")); if (is_numeric($dbmRadio) && is_numeric($minRadio) && is_numeric($maxRadio) && is_numeric($avgRadio)) { - $rrd_def = array( - 'DS:dbm:GAUGE:600:-100:0', - 'DS:min:GAUGE:600:-100:0', - 'DS:max:GAUGE:600:-100:0', - 'DS:avg:GAUGE:600:-100:0' - ); + $rrd_def = RrdDefinition::make() + ->addDataset('dbm', 'GAUGE', -100, 0) + ->addDataset('min', 'GAUGE', -100, 0) + ->addDataset('max', 'GAUGE', -100, 0) + ->addDataset('avg', 'GAUGE', -100, 0); $fields = array( 'dbm' => $dbmRadio, @@ -266,10 +260,9 @@ if (strstr($version, 'AP')) { $uplinkutilization = $multi_get_array[0]["WHISP-APS-MIB::frUtlLowTotalUplinkUtilization"]; if (is_numeric($registered) && is_numeric($failed)) { - $rrd_def = array( - 'DS:regCount:GAUGE:600:0:15000', - 'DS:failed:GAUGE:600:0:15000' - ); + $rrd_def = RrdDefinition::make() + ->addDataset('regCount', 'GAUGE', 0, 15000) + ->addDataset('failed', 'GAUGE', 0, 15000); $fields = array( 'regCount' => $registered, 'failed' => $failed, @@ -281,7 +274,7 @@ if (strstr($version, 'AP')) { } if (is_numeric($freq)) { - $rrd_def = 'DS:freq:GAUGE:600:0:100000'; + $rrd_def = RrdDefinition::make()->addDataset('freq', 'GAUGE', 0, 100000); if ($freq > 99999) { $freq = $freq / 100000; } else { @@ -297,10 +290,9 @@ if (strstr($version, 'AP')) { } if (is_numeric($downlinkutilization) && is_numeric($uplinkutilization)) { - $rrd_def = array( - 'DS:downlinkutilization:GAUGE:600:0:15000', - 'DS:uplinkutilization:GAUGE:600:0:15000' - ); + $rrd_def = RrdDefinition::make() + ->addDataset('downlinkutilization', 'GAUGE', 0, 15000) + ->addDataset('uplinkutilization', 'GAUGE', 0, 15000); $fields = array( 'downlinkutilization' => $downlinkutilization, 'uplinkutilization' => $uplinkutilization, diff --git a/includes/polling/wireless/cisco-wwan.inc.php b/includes/polling/wireless/cisco-wwan.inc.php index 9df483abeb..3157e23675 100644 --- a/includes/polling/wireless/cisco-wwan.inc.php +++ b/includes/polling/wireless/cisco-wwan.inc.php @@ -9,9 +9,11 @@ * the source code distribution for details. */ +use LibreNMS\RRD\RrdDefinition; + $rssi = snmp_get($device, "CISCO-WAN-3G-MIB::c3gCurrentGsmRssi.13", "-Ovqn", "CISCO-WAN-3G-MIB"); if (is_numeric($rssi)) { - $rrd_def = 'DS:rssi:GAUGE:600:-150:5000'; + $rrd_def = RrdDefinition::make()->addDataset('rssi', 'GAUGE', -150, 5000); $fields = array( 'rssi' => $rssi, ); @@ -22,7 +24,7 @@ if (is_numeric($rssi)) { $mnc = snmp_get($device, "CISCO-WAN-3G-MIB::c3gGsmMnc.13", "-Ovqn", "CISCO-WAN-3G-MIB"); if (is_numeric($mnc)) { - $rrd_def = 'DS:mnc:GAUGE:600:0:U'; + $rrd_def = RrdDefinition::make()->addDataset('mnc', 'GAUGE', 0); $fields = array( 'mnc' => $mnc, ); diff --git a/includes/polling/wireless/xirrus.inc.php b/includes/polling/wireless/xirrus.inc.php index bdad45a289..8f7a6424fa 100644 --- a/includes/polling/wireless/xirrus.inc.php +++ b/includes/polling/wireless/xirrus.inc.php @@ -1,4 +1,6 @@ $radio) { $measurement = 'xirrus_stats'; $rrd_name = array($measurement, $radioName); - $rrd_def = array( - 'DS:rssi:GAUGE:600:-150:0', - 'DS:dataRate:GAUGE:600:0:1400', - 'DS:noiseFloor:GAUGE:600:-150:0' - ); + $rrd_def = RrdDefinition::make() + ->addDataset('rssi', 'GAUGE', -150, 0) + ->addDataset('dataRate', 'GAUGE', 0, 1400) + ->addDataset('noiseFloor', 'GAUGE', -150, 0); $fields = array( 'rssi' => $rssi[$idx]['realtimeMonitorAverageRSSI'], 'dataRate' => $dataRate[$idx]['realtimeMonitorAverageDataRate'], @@ -42,7 +43,7 @@ if ($config['xirrus_disable_stations']!=true) { foreach ($associations as $radio => $count) { $measurement = 'xirrus_users'; $rrd_name = array($measurement, $radio); - $rrd_def = 'DS:stations:GAUGE:600:0:3200'; + $rrd_def = RrdDefinition::make()->addDataset('stations', 'GAUGE', 0, 3200); $fields = array( 'stations' => $count ); diff --git a/includes/rrdtool.inc.php b/includes/rrdtool.inc.php index bd29d92b6f..a261ff08e0 100644 --- a/includes/rrdtool.inc.php +++ b/includes/rrdtool.inc.php @@ -371,7 +371,7 @@ function rrdtool_tune($type, $filename, $max) * rrdtool backend implementation of data_update * * Tags: - * rrd_def array|string: (required) an array of rrd field definitions example: "DS:dataName:COUNTER:600:U:100000000000" + * rrd_def RrdDefinition * rrd_name array|string: the rrd filename, will be processed with rrd_name() * rrd_oldname array|string: old rrd filename to rename, will be processed with rrd_name() * rrd_step int: rrd step, defaults to 300 @@ -386,7 +386,7 @@ function rrdtool_data_update($device, $measurement, $tags, $fields) global $config; $rrd_name = $tags['rrd_name'] ?: $measurement; - $step = $tags['rrd_step'] ?: 300; + $step = $tags['rrd_step'] ?: $config['rrd']['step']; $oldname = $tags['rrd_oldname']; if (!empty($oldname)) { rrd_file_rename($device, $oldname, $rrd_name); @@ -399,10 +399,8 @@ function rrdtool_data_update($device, $measurement, $tags, $fields) $rrd = rrd_name($device['hostname'], $rrd_name); } - if ($tags['rrd_def'] && !rrdtool_check_rrd_exists($rrd)) { - $rrd_def = is_array($tags['rrd_def']) ? $tags['rrd_def'] : array($tags['rrd_def']); - // add the --step and the rra definitions to the command - $newdef = "--step $step " . implode(' ', $rrd_def) . $config['rrd_rra']; + if (isset($tags['rrd_def']) && !rrdtool_check_rrd_exists($rrd)) { + $newdef = "--step $step " . $tags['rrd_def'] . $config['rrd_rra']; rrdtool('create', $rrd, $newdef); } diff --git a/includes/services.inc.php b/includes/services.inc.php index c723863c96..310b31942f 100644 --- a/includes/services.inc.php +++ b/includes/services.inc.php @@ -1,5 +1,7 @@ $v) { if (($v['uom'] == 'c') && !(preg_match('/[Uu]ptime/', $k))) { // This is a counter, create the DS as such - $rrd_def[] = "DS:".$k.":COUNTER:600:0:U"; + $rrd_def->addDataset($k, 'COUNTER', 0); } else { // Not a counter, must be a gauge - $rrd_def[] = "DS:".$k.":GAUGE:600:0:U"; + $rrd_def->addDataset($k, 'GAUGE', 0); } } diff --git a/includes/snmp.inc.php b/includes/snmp.inc.php index fb964f0769..c9152280ab 100644 --- a/includes/snmp.inc.php +++ b/includes/snmp.inc.php @@ -15,6 +15,8 @@ * the source code distribution for details. */ +use LibreNMS\RRD\RrdDefinition; + function string_to_oid($string) { $oid = strlen($string); @@ -860,11 +862,15 @@ function snmp_translate($oid, $module, $mibdir = null, $device = array()) } // snmp_translate -/* +/** * check if the type of the oid is a numeric type, and if so, - * @return the name of RRD type that is best suited to saving it + * return the correct RrdDefinition + * + * @param string $oid + * @param array $mibdef + * @return RrdDefinition|false */ -function oid_rrd_type($oid, $mibdef) +function oid_rrd_def($oid, $mibdef) { if (!isset($mibdef[$oid])) { return false; @@ -881,15 +887,15 @@ function oid_rrd_type($oid, $mibdef) case 'INTEGER': case 'Integer32': - return 'GAUGE:600:U:U'; + return RrdDefinition::make()->addDataset('mibval', 'GAUGE'); case 'Counter32': case 'Counter64': - return 'COUNTER:600:0:U'; + return RrdDefinition::make()->addDataset('mibval', 'COUNTER', 0); case 'Gauge32': case 'Unsigned32': - return 'GAUGE:600:0:U'; + return RrdDefinition::make()->addDataset('mibval', 'GAUGE', 0); } return false; @@ -971,15 +977,15 @@ function save_mibs($device, $mibname, $oids, $mibdef, &$graphs) 'numvalue' => $numvalue, ); - $type = oid_rrd_type($obj, $mibdef); - if ($type === false) { + $rrd_def = oid_rrd_def($obj, $mibdef); + if ($rrd_def === false) { continue; } $usedoids[$index][$obj] = $val; $tags = array( - 'rrd_def' => array("DS:mibval:$type"), + 'rrd_def' => $rrd_def, 'rrd_name' => array($mibname, $mibdef[$obj]['shortname'], $index), 'rrd_oldname' => array($mibname, $mibdef[$obj]['object_type'], $index), 'index' => $index, diff --git a/sql-schema/167.sql b/sql-schema/167.sql new file mode 100644 index 0000000000..11fd9a63e4 --- /dev/null +++ b/sql-schema/167.sql @@ -0,0 +1 @@ +INSERT INTO config (config_name,config_value,config_default,config_descr,config_group,config_group_order,config_sub_group,config_sub_group_order,config_hidden,config_disabled) values ('rrd.step','300','300','Change the rrd step value (default 300)','external',0,'rrdtool',0,'0','0'), ('rrd.heartbeat','600','600','Change the rrd heartbeat value (default 600)','external',0,'rrdtool',0,'0','0'); diff --git a/tests/RrdDefinitionTest.php b/tests/RrdDefinitionTest.php new file mode 100644 index 0000000000..4fc679eec8 --- /dev/null +++ b/tests/RrdDefinitionTest.php @@ -0,0 +1,66 @@ +. + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2017 Tony Murray + * @author Tony Murray + */ + +namespace LibreNMS\Tests; + +use LibreNMS\RRD\RrdDefinition; + +class RrdDefinitionTest extends \PHPUnit_Framework_TestCase +{ + public function testEmpty() + { + + $this->assertEmpty((string)new RrdDefinition()); + } + + /** + * @expectedException \LibreNMS\Exceptions\InvalidRrdTypeException + */ + public function testWrongType() + { + $def = new RrdDefinition(); + $def->addDataset('badtype', 'Something unexpected'); + } + + public function testNameEscaping() + { + $expected = 'DS:bad_name-is_too_lon:GAUGE:600:0:100 '; + $def = RrdDefinition::make()->addDataset('b a%d$_n:a^me-is_too_lon%g.', 'GAUGE', 0, 100, 600); + + $this->assertEquals($expected, (string)$def); + } + + public function testCreation() + { + $expected = 'DS:pos:COUNTER:600:0:125000000000 ' . + 'DS:unbound:DERIVE:600:U:U '; + + $def = new RrdDefinition(); + $def->addDataset('pos', 'COUNTER', 0, 125000000000); + $def->addDataset('unbound', 'DERIVE'); + + $this->assertEquals($expected, $def); + } +}