summaryrefslogtreecommitdiffstats
path: root/python.d
diff options
context:
space:
mode:
authorlgz <lgz@loled2>2016-12-20 23:31:28 +0900
committerlgz <lgz@loled2>2016-12-20 23:31:28 +0900
commit5e7fb194e644ea46c6a4af6533de175118fcc2dc (patch)
tree24a937668bd27d4f62177f6344cb3bd91fa69a31 /python.d
parentad46d32ff417922a6ae63f63e2f6f52bdd3b157a (diff)
add proxy-auth and proxy-acc charts; make all charts except auth optional and disabled by default; conf file was updated
Diffstat (limited to 'python.d')
-rw-r--r--python.d/freeradius.chart.py37
1 files changed, 29 insertions, 8 deletions
diff --git a/python.d/freeradius.chart.py b/python.d/freeradius.chart.py
index cbf3be4e99..b047f37697 100644
--- a/python.d/freeradius.chart.py
+++ b/python.d/freeradius.chart.py
@@ -10,11 +10,11 @@ from subprocess import Popen, PIPE
# default module values (can be overridden per job in `config`)
priority = 60000
retries = 60
-update_every = 10
-directories = ['/bin/', '/usr/bin/', '/sbin/', '/usr/sbin/']
+update_every = 15
+directories = ['/bin/', '/usr/bin/', '/sbin', '/usr/sbin/']
# charts order (can be overridden if you want less charts, or different order)
-ORDER = ['authentication', 'accounting']
+ORDER = ['authentication', 'accounting', 'proxy-auth', 'proxy-acct']
CHARTS = {
'authentication': {
@@ -32,21 +32,39 @@ CHARTS = {
['acct-dropped-requests', None, 'incremental'], ['acct-duplicate-requests', None, 'incremental'],
['acct-invalid-requests', None, 'incremental'], ['acct-malformed-requests', None, 'incremental'],
['acct-unknown-types', None, 'incremental']
+ ]},
+ 'proxy-auth': {
+ 'options': [None, "Proxy Authentication", "packets/s", 'Authentication', 'freerad.proxy.auth', 'line'],
+ 'lines': [
+ ['proxy-access-accepts', None, 'incremental'], ['proxy-access-rejects', None, 'incremental'],
+ ['proxy-auth-dropped-requests', None, 'incremental'], ['proxy-auth-duplicate-requests', None, 'incremental'],
+ ['proxy-auth-invalid-requests', None, 'incremental'], ['proxy-auth-malformed-requests', None, 'incremental'],
+ ['proxy-auth-unknown-types', None, 'incremental']
+ ]},
+ 'proxy-acct': {
+ 'options': [None, "Proxy Accounting", "packets/s", 'Accounting', 'freerad.proxy.acct', 'line'],
+ 'lines': [
+ ['proxy-accounting-requests', None, 'incremental'], ['proxy-accounting-responses', None, 'incremental'],
+ ['proxy-acct-dropped-requests', None, 'incremental'], ['proxy-acct-duplicate-requests', None, 'incremental'],
+ ['proxy-acct-invalid-requests', None, 'incremental'], ['proxy-acct-malformed-requests', None, 'incremental'],
+ ['proxy-acct-unknown-types', None, 'incremental']
]}
+
}
class Service(SimpleService):
def __init__(self, configuration=None, name=None):
SimpleService.__init__(self, configuration=configuration, name=name)
- self.order = ORDER
- self.definitions = CHARTS
self.host = self.configuration.get('host', 'localhost')
self.port = self.configuration.get('port', '18121')
self.secret = self.configuration.get('secret', 'adminsecret')
+ self.acct = self.configuration.get('acct', False)
+ self.proxy_auth = self.configuration.get('proxy_auth', False)
+ self.proxy_acct = self.configuration.get('proxy_acct', False)
self.echo = [''.join([directory, 'echo']) for directory in directories if isfile(''.join([directory, 'echo']))][0]
self.radclient = [''.join([directory, 'radclient']) for directory in directories if isfile(''.join([directory, 'radclient']))][0]
- self.sub_echo = [self.echo, 'Message-Authenticator = 0x00, FreeRADIUS-Statistics-Type = 3, Response-Packet-Type = Access-Accept']
+ self.sub_echo = [self.echo, 'Message-Authenticator = 0x00, FreeRADIUS-Statistics-Type = 15, Response-Packet-Type = Access-Accept']
self.sub_radclient = [self.radclient, '-r', '1', '-t', '1', ':'.join([self.host, self.port]), 'status', self.secret]
def check(self):
@@ -54,7 +72,10 @@ class Service(SimpleService):
self.error('Command radclient not found')
return False
if self._get_raw_data():
- self.info('plugin was started succesfully')
+ chart_choice = [True, bool(self.acct), bool(self.proxy_auth), bool(self.proxy_acct)]
+ self.order = [chart for chart, choice in zip(ORDER, chart_choice) if choice]
+ self.definitions = {k:v for k, v in CHARTS.items() if k in self.order}
+ self.info('Plugin was started succesfully')
return True
else:
self.error('Request returned no data. Is server alive? Used options: host {}, port {}, secret {}'.format(self.host, self.port, self.secret))
@@ -72,7 +93,7 @@ class Service(SimpleService):
def _get_raw_data(self):
"""
The following code is equivalent to
- 'echo "Message-Authenticator = 0x00, FreeRADIUS-Statistics-Type = 3, Response-Packet-Type = Access-Accept" | radclient -t 1 -r 1 host:port status secret'
+ 'echo "Message-Authenticator = 0x00, FreeRADIUS-Statistics-Type = 15, Response-Packet-Type = Access-Accept" | radclient -t 1 -r 1 host:port status secret'
:return: str
"""
try: