From 89782b126fc0267a9f6f07cbcd68691e8b2b51a2 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Tue, 20 May 2008 01:23:25 +0000 Subject: [PATCH] * ffluci/statistics: first bunch of collectd plugin cbi models --- .../src/model/cbi/admin_statistics/csv.lua | 39 +++++++++++ .../src/model/cbi/admin_statistics/df.lua | 50 ++++++++++++++ .../src/model/cbi/admin_statistics/disk.lua | 37 +++++++++++ .../src/model/cbi/admin_statistics/dns.lua | 44 +++++++++++++ .../src/model/cbi/admin_statistics/email.lua | 55 ++++++++++++++++ .../src/model/cbi/admin_statistics/exec.lua | 77 ++++++++++++++++++++++ .../src/model/cbi/admin_statistics/index.lua | 16 ++--- .../src/model/cbi/admin_statistics/ping.lua | 38 +++++++++++ 8 files changed, 348 insertions(+), 8 deletions(-) create mode 100644 applications/luci-statistics/src/model/cbi/admin_statistics/df.lua create mode 100644 applications/luci-statistics/src/model/cbi/admin_statistics/disk.lua create mode 100644 applications/luci-statistics/src/model/cbi/admin_statistics/email.lua diff --git a/applications/luci-statistics/src/model/cbi/admin_statistics/csv.lua b/applications/luci-statistics/src/model/cbi/admin_statistics/csv.lua index e69de29bb..e1f2c351d 100644 --- a/applications/luci-statistics/src/model/cbi/admin_statistics/csv.lua +++ b/applications/luci-statistics/src/model/cbi/admin_statistics/csv.lua @@ -0,0 +1,39 @@ +--[[ + +Luci configuration model for statistics - collectd csv plugin configuration +(c) 2008 Freifunk Leipzig / Jo-Philipp Wich + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +$Id$ + +]]-- + +m = Map("luci_statistics", "CSV Plugin", +[[Das CSV-Plugin schreibt in regelmäßigen Abständen die gesammelten Daten als +CSV-Dateien in das angegebene Verzeichnis. Der Speicherbedarf wächst dabei +kontinuierlich!]]) + +-- collectd_csv config section +s = m:section( NamedSection, "collectd_csv", "luci_statistics", "Pluginkonfiguration" ) + +-- collectd_csv.enable +enable = s:option( Flag, "enable", "Plugin aktivieren" ) +enable.default = 0 + +-- collectd_csv.datadir (DataDir) +datadir = s:option( Value, "DataDir", "Ablageverzeichnis für die CSV-Dateien" ) +datadir.default = "127.0.0.1" +datadir:depends( "enable", 1 ) + +-- collectd_csv.storerates (StoreRates) +storerates = s:option( Flag, "StoreRates", "Werte nicht absolut, sondern als Raten speichern" ) +storerates.default = 0 +storerates:depends( "enable", 1 ) + +return m + diff --git a/applications/luci-statistics/src/model/cbi/admin_statistics/df.lua b/applications/luci-statistics/src/model/cbi/admin_statistics/df.lua new file mode 100644 index 000000000..6e35afcb3 --- /dev/null +++ b/applications/luci-statistics/src/model/cbi/admin_statistics/df.lua @@ -0,0 +1,50 @@ +--[[ + +Luci configuration model for statistics - collectd df plugin configuration +(c) 2008 Freifunk Leipzig / Jo-Philipp Wich + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +$Id$ + +]]-- + +m = Map("luci_statistics", "DF Plugin", +[[Das DF-Plugin sammelt Informationen über den belegten und verfügbaren Speicherplatz auf den +angegebenen Geräten, Mountpunkten oder Dateisystemtypen.]]) + +-- collectd_df config section +s = m:section( NamedSection, "collectd_df", "luci_statistics", "Pluginkonfiguration" ) + +-- collectd_df.enable +enable = s:option( Flag, "enable", "Plugin aktivieren" ) +enable.default = 0 + +-- collectd_df.devices (Device) +devices = s:option( Value, "Devices", "Gerätedateien", "Einträge mit Leerzeichen trennen" ) +devices.default = "/dev/mtdblock/4" +devices.rmempty = true +devices:depends( "enable", 1 ) + +-- collectd_df.mountpoints (MountPoint) +mountpoints = s:option( Value, "MountPoints", "Mountpunkte", "Einträge mit Leerzeichen trennen" ) +mountpoints.default = "/jffs" +mountpoints.rmempty = true +mountpoints:depends( "enable", 1 ) + +-- collectd_df.fstypes (FSType) +fstypes = s:option( Value, "FSTypes", "Dateisystemtypen", "Einträge mit Leerzeichen trennen" ) +fstypes.default = "tmpfs" +fstypes.rmempty = true +fstypes:depends( "enable", 1 ) + +-- collectd_df.ignoreselected (IgnoreSelected) +ignoreselected = s:option( Flag, "IgnoreSelected", "Logik umkehren und alle Datenträger überwachen die nicht auf die obigen Kriterien zutreffen" ) +ignoreselected.default = 0 +ignoreselected:depends( "enable", 1 ) + +return m diff --git a/applications/luci-statistics/src/model/cbi/admin_statistics/disk.lua b/applications/luci-statistics/src/model/cbi/admin_statistics/disk.lua new file mode 100644 index 000000000..587091fbd --- /dev/null +++ b/applications/luci-statistics/src/model/cbi/admin_statistics/disk.lua @@ -0,0 +1,37 @@ +--[[ + +Luci configuration model for statistics - collectd disk plugin configuration +(c) 2008 Freifunk Leipzig / Jo-Philipp Wich + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +$Id$ + +]]-- + +m = Map("luci_statistics", "Disk Plugin", +[[Das Disk-Plugin sammelt Informationen über Augewählte Fesplatten.]]) + +-- collectd_disk config section +s = m:section( NamedSection, "collectd_disk", "luci_statistics", "Pluginkonfiguration" ) + +-- collectd_disk.enable +enable = s:option( Flag, "enable", "Plugin aktivieren" ) +enable.default = 0 + +-- collectd_disk.disks (Disk) +devices = s:option( Value, "Disks", "Fesplatten oder Partitionen", "Einträge mit Leerzeichen trennen" ) +devices.default = "hda1 hdb" +devices.rmempty = true +devices:depends( "enable", 1 ) + +-- collectd_disk.ignoreselected (IgnoreSelected) +ignoreselected = s:option( Flag, "IgnoreSelected", "Logik umkehren und alle Datenträger und Partitionen überwachen die nicht auf die obigen Kriterien zutreffen" ) +ignoreselected.default = 0 +ignoreselected:depends( "enable", 1 ) + +return m diff --git a/applications/luci-statistics/src/model/cbi/admin_statistics/dns.lua b/applications/luci-statistics/src/model/cbi/admin_statistics/dns.lua index e69de29bb..02896d8e4 100644 --- a/applications/luci-statistics/src/model/cbi/admin_statistics/dns.lua +++ b/applications/luci-statistics/src/model/cbi/admin_statistics/dns.lua @@ -0,0 +1,44 @@ +--[[ + +Luci configuration model for statistics - collectd dns plugin configuration +(c) 2008 Freifunk Leipzig / Jo-Philipp Wich + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +$Id$ + +]]-- + +require("ffluci.model.uci") + + +m = Map("luci_statistics", "DNS Plugin", +[[Das DNS-Plugin nutzt die pcap Bibliothek um DNS-Verkehr zu analysieren.]]) + +-- collectd_dns config section +s = m:section( NamedSection, "collectd_dns", "luci_statistics", "Pluginkonfiguration" ) + +-- collectd_dns.enable +enable = s:option( Flag, "enable", "Plugin aktivieren" ) +enable.default = 0 + +-- collectd_dns.interfaces (Interface) +interfaces = s:option( ListValue, "Interface", "Folgende Schnittstelle überwachen:" ) +interfaces:depends( "enable", 1 ) +interfaces:value("any") +for k, v in pairs(ffluci.model.uci.sections("network")) do + if v[".type"] == "interface" and k ~= "loopback" then + interfaces:value(k) + end +end + +-- collectd_dns.ignoresources (IgnoreSource) +ignoresources = s:option( Value, "IgnoreSources", "Verkehr von folgenden IP Adressen ignorieren:", "mehrere Einträge mit Leerzeichen trennen" ) +ignoresources.default = "127.0.0.1" +ignoresources:depends( "enable", 1 ) + +return m diff --git a/applications/luci-statistics/src/model/cbi/admin_statistics/email.lua b/applications/luci-statistics/src/model/cbi/admin_statistics/email.lua new file mode 100644 index 000000000..49c11de11 --- /dev/null +++ b/applications/luci-statistics/src/model/cbi/admin_statistics/email.lua @@ -0,0 +1,55 @@ +--[[ + +Luci configuration model for statistics - collectd email plugin configuration +(c) 2008 Freifunk Leipzig / Jo-Philipp Wich + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +$Id$ + +]]-- + +m = Map("luci_statistics", "E-Mail Plugin", +[[Das E-Mail-Plugin öffnet einen Unix-Socket über welchen E-Mail Statistiken an collectd +übergeben werden können. Dieses Plugin ist primär für die Verwendung mit +Mail::SpamAssassin::Plugin::Collectd gedacht, lässt sich aber auch anderweitig einsetzen.]]) + +-- collectd_email config section +s = m:section( NamedSection, "collectd_email", "luci_statistics", "Pluginkonfiguration" ) + +-- collectd_email.enable +enable = s:option( Flag, "enable", "Plugin aktivieren" ) +enable.default = 0 + +-- collectd_email.socketfile (SocketFile) +socketfile = s:option( Value, "SocketFile", "Pfad für den Unix-Socket" ) +socketfile.default = "/var/run/collect-email.socket" +socketfile:depends( "enable", 1 ) + +-- collectd_email.socketgroup (SocketGroup) +socketgroup = s:option( Value, "SocketGroup", "Dateibesitzergruppe für den Unix-Socket ändern" ) +socketgroup.default = "nobody" +socketgroup.rmempty = true +socketgroup.optional = true +socketgroup:depends( "enable", 1 ) + +-- collectd_email.socketperms (SocketPerms) +socketperms = s:option( Value, "SocketPerms", "Dateiberechtigungen für den Unix-Socket ändern" ) +socketperms.default = "0770" +socketperms.rmempty = true +socketperms.optional = true +socketperms:depends( "enable", 1 ) + +-- collectd_email.maxconns (MaxConns) +maxconns = s:option( Value, "MaxConns", "Maximale Anzahl paralleler Verbindungen", "Werte von 1 bis 16384" ) +maxconns.default = 5 +maxconns.isinteger = true +maxconns.rmempty = true +maxconns.optional = true +maxconns:depends( "enable", 1 ) + +return m diff --git a/applications/luci-statistics/src/model/cbi/admin_statistics/exec.lua b/applications/luci-statistics/src/model/cbi/admin_statistics/exec.lua index e69de29bb..d1fe0f0db 100644 --- a/applications/luci-statistics/src/model/cbi/admin_statistics/exec.lua +++ b/applications/luci-statistics/src/model/cbi/admin_statistics/exec.lua @@ -0,0 +1,77 @@ +--[[ + +Luci configuration model for statistics - collectd exec plugin configuration +(c) 2008 Freifunk Leipzig / Jo-Philipp Wich + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +$Id$ + +]]-- + +m = Map("luci_statistics", "Exec Plugin", +[[Das Exec-Plugin ermöglicht das Ausführen von externen Programmen um Werte einzulesen +oder Aktionen beim Eintreten bestimmter Ereignisse anzustoßen.]]) + +-- collectd_exec config section +s = m:section( NamedSection, "collectd_exec", "luci_statistics", "Pluginkonfiguration" ) + +-- collectd_exec.enable +enable = s:option( Flag, "enable", "Plugin aktivieren" ) +enable.default = 0 + + +-- collectd_exec_input config section (Exec directives) +exec = m:section( TypedSection, "collectd_exec_input", "Befehl zum Einlesen von Daten hinzufügen", +[[Hier können externe Kommandos definiert werden welche durch collectd gestartet werden um bestimmte +Daten zu sammeln. Die Werte werden dabei von der Standardausgabe des Programmes gelesen.]]) +exec.addremove = true +exec.anonymous = true + +-- collectd_exec_input.cmdline +exec_cmdline = exec:option( Value, "cmdline", "Kommandozeile" ) +exec_cmdline.default = "/usr/bin/stat-dhcpusers" + +-- collectd_exec_input.cmdline +exec_cmduser = exec:option( Value, "cmduser", "Als anderer Benutzer ausführen" ) +exec_cmduser.default = "nobody" +exec_cmduser.rmempty = true +exec_cmduser.optional = true + +-- collectd_exec_input.cmdline +exec_cmdgroup = exec:option( Value, "cmdgroup", "Als andere Gruppe ausführen" ) +exec_cmdgroup.default = "nogroup" +exec_cmdgroup.rmempty = true +exec_cmdgroup.optional = true + + +-- collectd_exec_notify config section (NotifyExec directives) +notify = m:section( TypedSection, "collectd_exec_notify", "Befehl zum Ausgeben von Daten hinzufügen", +[[Hier können externe Kommandos definiert werden welche zur Ausführung kommen sobald bestimmte +Ereignise eintreten. Die Daten werden dabei an die Standardeingabe des aufgerufenen Programmes gesendet. +Siehe dazu auch die Sektion "Limits".]]) +notify.addremove = true +notify.anonymous = true + +-- collectd_notify_input.cmdline +notify_cmdline = notify:option( Value, "cmdline", "Kommandozeile" ) +notify_cmdline.default = "/usr/bin/stat-dhcpusers" + +-- collectd_notify_input.cmdline +notify_cmduser = notify:option( Value, "cmduser", "Als anderer Benutzer ausführen" ) +notify_cmduser.default = "nobody" +notify_cmduser.rmempty = true +notify_cmduser.optional = true + +-- collectd_notify_input.cmdline +notify_cmdgroup = notify:option( Value, "cmdgroup", "Als andere Gruppe ausführen" ) +notify_cmdgroup.default = "nogroup" +notify_cmdgroup.rmempty = true +notify_cmdgroup.optional = true + + +return m diff --git a/applications/luci-statistics/src/model/cbi/admin_statistics/index.lua b/applications/luci-statistics/src/model/cbi/admin_statistics/index.lua index 743909c18..21ff457e3 100644 --- a/applications/luci-statistics/src/model/cbi/admin_statistics/index.lua +++ b/applications/luci-statistics/src/model/cbi/admin_statistics/index.lua @@ -16,28 +16,28 @@ $Id$ require("ffluci.sys") -m = Map("collectd", "Collector Daemon", +m = Map("luci_statistics", "Collector Daemon", [[Collectd ist ein kleiner und flexibler Dienst zum Sammeln und Abfragen von Daten aus verschieden Quellen. Zur weiteren Verarbeitung werden die Daten in RRD Datenbanken -gespeichert oder per Multicast Relaying über das Netzwerk versendet.]]) +gespeichert oder per Multicast Relaying über das Netzwerk versendet.]]) -- general config section -s = m:section( NamedSection, "general", "collectd", "Allgemeine Einstellungen" ) +s = m:section( NamedSection, "general", "luci_statistics", "Allgemeine Einstellungen" ) -- general.basedir (BaseDir) basedir = s:option( Value, "BaseDir", "Basisverzeichnis" ) basedir.default = "/var/run/collectd" -- general.include (Include) -include = s:option( Value, "Include", "Verzeichnis für Unterkonfigurationen" ) +include = s:option( Value, "Include", "Verzeichnis für Unterkonfigurationen" ) include.default = "/etc/collectd/conf.d/*.conf" -- general.pidfile (PIDFile) -pidfile = s:option( Value, "PIDFile", "PID-Datei für den Collector Dienst" ) +pidfile = s:option( Value, "PIDFile", "PID-Datei für den Collector Dienst" ) pidfile.default = "/var/run/collectd.pid" -- general.plugindir (PluginDir) -plugindir = s:option( Value, "PluginDir", "Verzeichnis für die Collector-Plugins" ) +plugindir = s:option( Value, "PluginDir", "Verzeichnis für die Collector-Plugins" ) plugindir.default = "/usr/lib/collectd/" -- general.typesdb (TypesDB) @@ -45,12 +45,12 @@ typesdb = s:option( Value, "TypesDB", "Datenbank mit den Datenset-Beschreibungen typesdb.default = "/etc/collectd/types.db" -- general.interval (Interval) -interval = s:option( Value, "Interval", "Abfrageintervall für die Datenerfassung in Sekunden" ) +interval = s:option( Value, "Interval", "Abfrageintervall für die Datenerfassung", "Sekunden" ) interval.default = 60 interval.isnumber = true -- general.readthreads (ReadThreads) -readthreads = s:option( Value, "ReadThreads", "Anzahl paralleler Prozesse für die Datenabfrage" ) +readthreads = s:option( Value, "ReadThreads", "Anzahl paralleler Prozesse für die Datenabfrage" ) readthreads.default = 5 readthreads.isnumber = true diff --git a/applications/luci-statistics/src/model/cbi/admin_statistics/ping.lua b/applications/luci-statistics/src/model/cbi/admin_statistics/ping.lua index e69de29bb..334a0300d 100644 --- a/applications/luci-statistics/src/model/cbi/admin_statistics/ping.lua +++ b/applications/luci-statistics/src/model/cbi/admin_statistics/ping.lua @@ -0,0 +1,38 @@ +--[[ + +Luci configuration model for statistics - collectd ping plugin configuration +(c) 2008 Freifunk Leipzig / Jo-Philipp Wich + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +$Id$ + +]]-- + +m = Map("luci_statistics", "Ping Plugin", +[[Das Ping-Plugin veranlasst periodische ICMP-Requests an die angegebenen Adressen und zeichnet +Parameter wie Verfügbarkeit und Antwortzeiten auf.]]) + +-- collectd_ping config section +s = m:section( NamedSection, "collectd_ping", "luci_statistics", "Pluginkonfiguration" ) + +-- collectd_ping.enable +enable = s:option( Flag, "enable", "Plugin aktivieren" ) +enable.default = 0 + +-- collectd_ping.hosts (Host) +hosts = s:option( Value, "Hosts", "Zieladressen", "Einträge durch Leerzeichen trennen" ) +hosts.default = "127.0.0.1" +hosts:depends( "enable", 1 ) + +-- collectd_ping.ttl (TTL) +ttl = s:option( Value, "TTL", "Time-to-Live für die ICMP-Pakete (Werte 0 bis 255)" ) +ttl.isinteger = true +ttl.default = 128 +ttl:depends( "enable", 1 ) + +return m -- 2.11.0