From 8a2cfbd1b6fe6036c86ee4257e748d54cb98fef0 Mon Sep 17 00:00:00 2001
From: Jan Philipp Timme <jan.philipp@timme.it>
Date: Thu, 8 Aug 2019 18:40:54 +0200
Subject: [PATCH] Add additional plugin for RadSecProxy

---
 radsecproxy-logstats.sh | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
 create mode 100755 radsecproxy-logstats.sh

diff --git a/radsecproxy-logstats.sh b/radsecproxy-logstats.sh
new file mode 100755
index 0000000..484a33b
--- /dev/null
+++ b/radsecproxy-logstats.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+#
+# This script is supposed to be called periodically.
+# It goes through the last few lines of a radsecproxy log and counts events.
+# The resulting numbers are then reported in the simple check_mk format.
+#
+
+# Debugging option
+#set -x
+
+# Go into appropriate directory
+cd `dirname $0`
+
+# Include log watch functions
+. ./logwatch.functions.sh
+
+# Use helper function to get $log_start and $log_end for current log
+lookAtLog "/var/log/freeradius/radius.log" "radsecproxy-logstats.db"
+
+
+### Initialize counters ###
+login_ok=0
+login_incorrect=0
+
+### Do the statistics ###
+
+access_accept=$(getLogLines | grep 'Access-Accept for user' | wc -l)
+access_reject=$(getLogLines | grep 'Access-Reject for user' | wc -l)
+
+### Report counter results ###
+echo "P RadSecProxy-logstats access-accept=$access_accept|access-reject=$access_reject Additional metrics from RadSecProxy"
+
+# That's it.
+exit 0
+
-- 
GitLab