From 7e55d1cd5db04019de09aff7b134a85df71e901a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Istv=C3=A1n=20S=C3=A1r=C3=A1ndi?= Date: Mon, 25 Jun 2018 16:10:00 +0200 Subject: [PATCH] Update fail2ban extend script to new JSON format (#181) As seen at [this location](https://github.com/librenms/librenms/blob/7fab99cfc13b80a543fb779d68c659b52fc074b1/includes/polling/functions.inc.php#L768) the JSON output needs to contain a `data` field. The poller php script actually also extracts this `data` field as one of the first steps, see at [this line](https://github.com/librenms/librenms/blob/c3007b483a12758042e5d0c6009a8ef48e3e1a39/includes/polling/applications/fail2ban.inc.php#L36). Before I changed these parts the graph didn't show up because the RRD files simply weren't generated as an exception occurred in the poller. This fixes this problem. --- snmp/fail2ban | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/snmp/fail2ban b/snmp/fail2ban index f965c55..8564002 100644 --- a/snmp/fail2ban +++ b/snmp/fail2ban @@ -105,8 +105,9 @@ sub main::HELP_MESSAGE { #generats stats sub stats{ my %toReturn; - $toReturn{total}=0; # total number in jails - $toReturn{jails}={}; # each jail + $toReturn{data}={}; + $toReturn{data}{total}=0; # total number in jails + $toReturn{data}{jails}={}; # each jail $toReturn{error}=0; # error code, 0 if good $toReturn{errorString}=''; # detailed description of any errors $toReturn{version}='1'; # format version of the returned data @@ -147,8 +148,8 @@ sub stats{ $jailTotal=~s/\s//g; #tally the total and add this jail to the list - $toReturn{total} = $toReturn{total} + $jailTotal; - $toReturn{jails}{ $jails[$int] } = $jailTotal; + $toReturn{data}{total} = $toReturn{data}{total} + $jailTotal; + $toReturn{data}{jails}{ $jails[$int] } = $jailTotal; $int++; }