Added Unbound graph support #4074

Merged
merged 10 commits into from Aug 17, 2016

Projects

None yet

3 participants

@alangregory
Contributor

Please note

Please read this information carefully.

@alangregory alangregory Added Unbound Support
772d7fa
@alangregory alangregory Fix array declaration 5.3 compatible
00c5c65
@murrant murrant and 1 other commented on an outdated diff Aug 15, 2016
includes/polling/applications/unbound.inc.php
+$app_id = $app['app_id'];
+if (!empty($agent_data['app'][$name])) {
+ $rawdata = $agent_data['app'][$name];
+}else{
+ echo "Unbound Missing";
+ return;
+}
+#Format Data
+$lines = explode("\n",$rawdata);
+$unbound = array();
+foreach ($lines as $line) {
+ list($var,$value) = explode('=',$line);
+ $unbound[$var] = $value;
+}
+#Unbound Queries
+$rrd_name = array('app', $name."-queries",$app_id);
@murrant
murrant Aug 15, 2016 Contributor

this uses the rrd_name() function,
You could just use:

$rrd_name =  array('app', $name, 'queries', $app_id)
@alangregory
alangregory Aug 15, 2016 Contributor

Thanks for pointing out.

@murrant
Contributor
murrant commented Aug 15, 2016 edited

Thanks! You will need to add something to the Documentation as well.

@alangregory alangregory Fix parameter order
8c0735d
@alangregory
Contributor

I'll add docs as soon as i finish the unix-agent script.

alangregory added some commits Aug 16, 2016
@alangregory alangregory Added unbound unix agent script 08460ba
@alangregory alangregory Adeed unbound App setup docs
1f15bc6
@alangregory alangregory Added menu entry
4098494
@alangregory alangregory Fix tipo
cee72a4
@murrant murrant and 1 other commented on an outdated diff Aug 16, 2016
doc/Extensions/Applications.md
@@ -168,6 +168,24 @@ extend memcached /usr/local/bin/memcached
4. Restart snmpd on your host
5. On the device page in Librenms, edit your host and check `Memcached` under the Applications tab.
+### Unbound
+
+##### Agent
+[Install the agent](#agent-setup) on this device if it isn't already and copy the `unbound.sh` script to `/usr/lib/check_mk_agent/local/`
+
+Unbound configuration:
+
+```text
+# Enable extended statistics.
+server:
+ statistics-interval: 0
+ extended-statistics: yes
+ # set to yes if graphing tool needs it
@murrant
murrant Aug 16, 2016 Contributor

Why is this comment here?

@alangregory
alangregory Aug 17, 2016 Contributor

It's from the oficial guide Unbound: How to Statistics , fixed on 8e7d40c

@murrant murrant and 1 other commented on an outdated diff Aug 16, 2016
scripts/unbound.sh
@@ -0,0 +1,8 @@
+#!/bin/bash
+unboundctl=`which unbound-control`
@murrant
murrant Aug 16, 2016 Contributor

We have been putting these scripts in the librenms-agent repo.

@alangregory
alangregory Aug 17, 2016 Contributor

Removed here 3ec0b94 and moved to librenms/librenms-agent#50

@murrant murrant and 1 other commented on an outdated diff Aug 16, 2016
includes/polling/applications/unbound.inc.php
+ 'wks' => $unbound['num.query.type.WKS'],
+ 'ptr' => $unbound['num.query.type.PTR'],
+ 'mx' => $unbound['num.query.type.MX'],
+ 'txt' => $unbound['num.query.type.TXT'],
+ 'aaaa' => $unbound['num.query.type.AAAA'],
+ 'srv' => $unbound['num.query.type.SRV'],
+ 'naptr' => $unbound['num.query.type.NAPTR'],
+ 'ds' => $unbound['num.query.type.DS'],
+ 'dnskey' => $unbound['num.query.type.DNSKEY'],
+ 'spf' => $unbound['num.query.type.SPF'],
+ 'any' => $unbound['num.query.type.ANY'],
+ 'other' => $unbound['num.query.type.other']
+ );
+$tags = compact('name', 'app_id', 'rrd_name', 'rrd_def');
+data_update($device, 'app', $tags, $fields);
+$status = true;
@murrant
murrant Aug 16, 2016 Contributor

Unused variable?

@alangregory
alangregory Aug 17, 2016 Contributor

Fixed on 9de3d43

alangregory added some commits Aug 17, 2016
@alangregory alangregory Removed comment and set default value to yes acording to poller 8e7d40c
@alangregory alangregory Fix unused variable 9de3d43
@alangregory alangregory Moved unbound script to librenms agent repository
3ec0b94
@murrant murrant merged commit fe784ae into librenms:master Aug 17, 2016

2 checks passed

Auto-Deploy Build finished.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment