From b5843bcd816109f548a6086f1f9188841e419fff Mon Sep 17 00:00:00 2001 From: Joel Johnson Date: Thu, 30 Jul 2020 21:42:53 -0600 Subject: [PATCH] luci-app-statistics: add users plugin support The users plugin is functional and useful, but requires usage of custom built packages of busybox, dropbear, openssh, or other console/shell access mechanisms. Signed-off-by: Joel Johnson --- .../statistics/rrdtool/definitions/users.js | 23 +++++++++++++++++++ .../view/statistics/plugins/users.js | 16 +++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/users.js create mode 100644 applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/users.js diff --git a/applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/users.js b/applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/users.js new file mode 100644 index 0000000000..06921a3f76 --- /dev/null +++ b/applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/users.js @@ -0,0 +1,23 @@ +/* Licensed to the public under the Apache License 2.0. */ + +'use strict'; +'require baseclass'; + +return baseclass.extend({ + title: _('Users'), + + rrdargs: function(graph, host, plugin, plugin_instance, dtype) { + return { + title: "%H: Users (console logins)", + vlabel: "count", + data: { + types: [ "users" ], + options: { + users: { + title: "Users %di", + } + } + } + }; + } +}); diff --git a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/users.js b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/users.js new file mode 100644 index 0000000000..05b5eb8849 --- /dev/null +++ b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/users.js @@ -0,0 +1,16 @@ +'use strict'; +'require baseclass'; +'require form'; + +return baseclass.extend({ + title: _('Users Plugin Configuration'), + description: _('The users plugin collects statistics about users logged in locally via shell. NOTE: Local shell (wtmp) tracking is NOT enabled in default builds. Additional setup is required to get non-zero counts.'), + + addFormOptions: function(s) { + var o = s.option(form.Flag, 'enable', _('Enable this plugin')); + }, + + configSummary: function(section) { + return _('Monitoring shell users count'); + } +}); -- 2.30.2