luci-app-statistics: add dhcpleases

Add the dhcpleases plugin:
https://github.com/openwrt/packages/pull/14204

Added-Frontend-by: Hannu Nyman <hannu.nyman@iki.fi>
Signed-off-by: Nick Hainke <vincent@systemli.org>

[Minor changes to graph: alt_autoscale, precision, label]
Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
This commit is contained in:
Nick Hainke 2020-12-12 18:29:54 +02:00 committed by Hannu Nyman
parent 7b5b7fbcd6
commit f8552afb1c
4 changed files with 59 additions and 0 deletions

View file

@ -0,0 +1,25 @@
/* Licensed to the public under the Apache License 2.0. */
'use strict';
'require baseclass';
return baseclass.extend({
title: _('DHCP Leases'),
rrdargs: function(graph, host, plugin, plugin_instance, dtype) {
return {
title: "%H: DHCP leases",
alt_autoscale_max: true,
vlabel: "Leases given",
number_format: "%3.0lf",
data: {
types: [ "count" ],
options: {
count: {
title: "Leases"
}
}
}
};
}
});

View file

@ -0,0 +1,21 @@
'use strict';
'require baseclass';
'require form';
return baseclass.extend({
title: _('DHCP Leases Plugin Configuration'),
description: _('The dhcpleases plugin collects information about assigned DHCP leases.'),
addFormOptions: function(s) {
var o;
o = s.option(form.Flag, 'enable', _('Enable this plugin'));
o = s.option(form.Value, 'Path', _('DHCP leases file'));
o.default = '/tmp/dhcp.leases';
},
configSummary: function(section) {
return _('Monitoring DHCP leases enabled');
}
});

View file

@ -86,6 +86,10 @@ config statistics 'collectd_df'
option IgnoreSelected '0'
option ValuesPercentage '0'
config statistics 'collectd_dhcpleases'
option enable '0'
option Path '/tmp/dhcp.leases'
config statistics 'collectd_disk'
option enable '0'
option Disks 'hda1 hdb'

View file

@ -0,0 +1,9 @@
{
"title": "Dhcpleases",
"category": "network",
"legend": [
[],
[],
["Path"]
]
}