From 52f54cf122d79d876c234cfaa5d8a09861a7bda1 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Sat, 19 Jul 2014 12:35:32 +0200 Subject: [PATCH] split announce.d into nodeinfo + statistics --- gluon/gluon-alfred/files/lib/gluon/cron/alfred | 3 ++- gluon/gluon-announce/files/lib/gluon/announce/announce.lua | 3 ++- .../gluon/announce/{announce.d => nodeinfo.d}/hardware/model | 0 .../lib/gluon/announce/{announce.d => nodeinfo.d}/hostname | 0 .../lib/gluon/announce/{announce.d => nodeinfo.d}/network/mac | 0 .../lib/gluon/announce/{announce.d => nodeinfo.d}/node_id | 0 .../announce/{announce.d => nodeinfo.d}/software/firmware | 0 .../announce/{announce.d/statistics => statistics.d}/idletime | 0 .../announce/{announce.d/statistics => statistics.d}/loadavg | 0 .../announce/{announce.d/statistics => statistics.d}/memory | 0 .../files/lib/gluon/announce/statistics.d/node_id | 1 + .../announce/{announce.d/statistics => statistics.d}/processes | 0 .../announce/{announce.d/statistics => statistics.d}/uptime | 0 .../files/etc/hotplug.d/iface/10-gluon-announced | 2 +- .../network/ath9k_workaround_trigger | 0 .../announce/{announce.d => nodeinfo.d}/software/autoupdater | 0 .../announce/{announce.d => nodeinfo.d}/network/addresses | 0 .../{announce.d => nodeinfo.d}/network/mesh_interfaces | 0 .../announce/{announce.d => nodeinfo.d}/software/batman-adv | 0 .../announce/{announce.d/network => statistics.d}/gateway | 0 .../announce/{announce.d/statistics => statistics.d}/traffic | 0 .../gluon/announce/{announce.d => nodeinfo.d}/software/fastd | 0 .../lib/gluon/announce/{announce.d => nodeinfo.d}/location | 0 .../files/lib/gluon/announce/{announce.d => nodeinfo.d}/owner | 0 24 files changed, 6 insertions(+), 3 deletions(-) rename gluon/gluon-announce/files/lib/gluon/announce/{announce.d => nodeinfo.d}/hardware/model (100%) rename gluon/gluon-announce/files/lib/gluon/announce/{announce.d => nodeinfo.d}/hostname (100%) rename gluon/gluon-announce/files/lib/gluon/announce/{announce.d => nodeinfo.d}/network/mac (100%) rename gluon/gluon-announce/files/lib/gluon/announce/{announce.d => nodeinfo.d}/node_id (100%) rename gluon/gluon-announce/files/lib/gluon/announce/{announce.d => nodeinfo.d}/software/firmware (100%) rename gluon/gluon-announce/files/lib/gluon/announce/{announce.d/statistics => statistics.d}/idletime (100%) rename gluon/gluon-announce/files/lib/gluon/announce/{announce.d/statistics => statistics.d}/loadavg (100%) rename gluon/gluon-announce/files/lib/gluon/announce/{announce.d/statistics => statistics.d}/memory (100%) create mode 100644 gluon/gluon-announce/files/lib/gluon/announce/statistics.d/node_id rename gluon/gluon-announce/files/lib/gluon/announce/{announce.d/statistics => statistics.d}/processes (100%) rename gluon/gluon-announce/files/lib/gluon/announce/{announce.d/statistics => statistics.d}/uptime (100%) rename gluon/gluon-ath9k-workaround/files/lib/gluon/announce/{announce.d => statistics.d}/network/ath9k_workaround_trigger (100%) rename gluon/gluon-autoupdater/files/lib/gluon/announce/{announce.d => nodeinfo.d}/software/autoupdater (100%) rename gluon/gluon-mesh-batman-adv/files/lib/gluon/announce/{announce.d => nodeinfo.d}/network/addresses (100%) rename gluon/gluon-mesh-batman-adv/files/lib/gluon/announce/{announce.d => nodeinfo.d}/network/mesh_interfaces (100%) rename gluon/gluon-mesh-batman-adv/files/lib/gluon/announce/{announce.d => nodeinfo.d}/software/batman-adv (100%) rename gluon/gluon-mesh-batman-adv/files/lib/gluon/announce/{announce.d/network => statistics.d}/gateway (100%) rename gluon/gluon-mesh-batman-adv/files/lib/gluon/announce/{announce.d/statistics => statistics.d}/traffic (100%) rename gluon/gluon-mesh-vpn-fastd/files/lib/gluon/announce/{announce.d => nodeinfo.d}/software/fastd (100%) rename gluon/gluon-node-info/files/lib/gluon/announce/{announce.d => nodeinfo.d}/location (100%) rename gluon/gluon-node-info/files/lib/gluon/announce/{announce.d => nodeinfo.d}/owner (100%) diff --git a/gluon/gluon-alfred/files/lib/gluon/cron/alfred b/gluon/gluon-alfred/files/lib/gluon/cron/alfred index 2d93162..72f219a 100644 --- a/gluon/gluon-alfred/files/lib/gluon/cron/alfred +++ b/gluon/gluon-alfred/files/lib/gluon/cron/alfred @@ -1 +1,2 @@ -* * * * * /lib/gluon/announce/announce.lua | gzip | alfred -s 158 +* * * * * /lib/gluon/announce/announce.lua nodeinfo | gzip | alfred -s 158 +* * * * * /lib/gluon/announce/announce.lua statistics | gzip | alfred -s 159 diff --git a/gluon/gluon-announce/files/lib/gluon/announce/announce.lua b/gluon/gluon-announce/files/lib/gluon/announce/announce.lua index e51445f..7bce0a7 100755 --- a/gluon/gluon-announce/files/lib/gluon/announce/announce.lua +++ b/gluon/gluon-announce/files/lib/gluon/announce/announce.lua @@ -1,6 +1,6 @@ #!/usr/bin/lua -local announce_dir = '/lib/gluon/announce/announce.d' +local announce_base = '/lib/gluon/announce/' fs = require 'luci.fs' @@ -37,6 +37,7 @@ function collect_dir(dir) return ret end +local announce_dir = announce_base .. arg[1] .. '.d/' encoder = json.Encoder(collect_dir(announce_dir)) ltn12.pump.all(encoder:source(), ltn12.sink.file(io.stdout)) diff --git a/gluon/gluon-announce/files/lib/gluon/announce/announce.d/hardware/model b/gluon/gluon-announce/files/lib/gluon/announce/nodeinfo.d/hardware/model similarity index 100% rename from gluon/gluon-announce/files/lib/gluon/announce/announce.d/hardware/model rename to gluon/gluon-announce/files/lib/gluon/announce/nodeinfo.d/hardware/model diff --git a/gluon/gluon-announce/files/lib/gluon/announce/announce.d/hostname b/gluon/gluon-announce/files/lib/gluon/announce/nodeinfo.d/hostname similarity index 100% rename from gluon/gluon-announce/files/lib/gluon/announce/announce.d/hostname rename to gluon/gluon-announce/files/lib/gluon/announce/nodeinfo.d/hostname diff --git a/gluon/gluon-announce/files/lib/gluon/announce/announce.d/network/mac b/gluon/gluon-announce/files/lib/gluon/announce/nodeinfo.d/network/mac similarity index 100% rename from gluon/gluon-announce/files/lib/gluon/announce/announce.d/network/mac rename to gluon/gluon-announce/files/lib/gluon/announce/nodeinfo.d/network/mac diff --git a/gluon/gluon-announce/files/lib/gluon/announce/announce.d/node_id b/gluon/gluon-announce/files/lib/gluon/announce/nodeinfo.d/node_id similarity index 100% rename from gluon/gluon-announce/files/lib/gluon/announce/announce.d/node_id rename to gluon/gluon-announce/files/lib/gluon/announce/nodeinfo.d/node_id diff --git a/gluon/gluon-announce/files/lib/gluon/announce/announce.d/software/firmware b/gluon/gluon-announce/files/lib/gluon/announce/nodeinfo.d/software/firmware similarity index 100% rename from gluon/gluon-announce/files/lib/gluon/announce/announce.d/software/firmware rename to gluon/gluon-announce/files/lib/gluon/announce/nodeinfo.d/software/firmware diff --git a/gluon/gluon-announce/files/lib/gluon/announce/announce.d/statistics/idletime b/gluon/gluon-announce/files/lib/gluon/announce/statistics.d/idletime similarity index 100% rename from gluon/gluon-announce/files/lib/gluon/announce/announce.d/statistics/idletime rename to gluon/gluon-announce/files/lib/gluon/announce/statistics.d/idletime diff --git a/gluon/gluon-announce/files/lib/gluon/announce/announce.d/statistics/loadavg b/gluon/gluon-announce/files/lib/gluon/announce/statistics.d/loadavg similarity index 100% rename from gluon/gluon-announce/files/lib/gluon/announce/announce.d/statistics/loadavg rename to gluon/gluon-announce/files/lib/gluon/announce/statistics.d/loadavg diff --git a/gluon/gluon-announce/files/lib/gluon/announce/announce.d/statistics/memory b/gluon/gluon-announce/files/lib/gluon/announce/statistics.d/memory similarity index 100% rename from gluon/gluon-announce/files/lib/gluon/announce/announce.d/statistics/memory rename to gluon/gluon-announce/files/lib/gluon/announce/statistics.d/memory diff --git a/gluon/gluon-announce/files/lib/gluon/announce/statistics.d/node_id b/gluon/gluon-announce/files/lib/gluon/announce/statistics.d/node_id new file mode 100644 index 0000000..7ff75b2 --- /dev/null +++ b/gluon/gluon-announce/files/lib/gluon/announce/statistics.d/node_id @@ -0,0 +1 @@ +return require('gluon.sysconfig').primary_mac:gsub(':', '') diff --git a/gluon/gluon-announce/files/lib/gluon/announce/announce.d/statistics/processes b/gluon/gluon-announce/files/lib/gluon/announce/statistics.d/processes similarity index 100% rename from gluon/gluon-announce/files/lib/gluon/announce/announce.d/statistics/processes rename to gluon/gluon-announce/files/lib/gluon/announce/statistics.d/processes diff --git a/gluon/gluon-announce/files/lib/gluon/announce/announce.d/statistics/uptime b/gluon/gluon-announce/files/lib/gluon/announce/statistics.d/uptime similarity index 100% rename from gluon/gluon-announce/files/lib/gluon/announce/announce.d/statistics/uptime rename to gluon/gluon-announce/files/lib/gluon/announce/statistics.d/uptime diff --git a/gluon/gluon-announced/files/etc/hotplug.d/iface/10-gluon-announced b/gluon/gluon-announced/files/etc/hotplug.d/iface/10-gluon-announced index b5546ff..4fb154f 100644 --- a/gluon/gluon-announced/files/etc/hotplug.d/iface/10-gluon-announced +++ b/gluon/gluon-announced/files/etc/hotplug.d/iface/10-gluon-announced @@ -21,7 +21,7 @@ restart_announced () { DEVS=$(cat $DEVLIST | while read dev iface;do echo -n " -i $dev";done) service_stop $DAEMON - service_start $DAEMON -g ff02:0:0:0:0:0:2:1001 -p 1001 -s /lib/gluon/announce/announce.lua $DEVS + service_start $DAEMON -g ff02:0:0:0:0:0:2:1001 -p 1001 -s '/lib/gluon/announce/announce.lua nodeinfo' $DEVS } case "$ACTION" in diff --git a/gluon/gluon-ath9k-workaround/files/lib/gluon/announce/announce.d/network/ath9k_workaround_trigger b/gluon/gluon-ath9k-workaround/files/lib/gluon/announce/statistics.d/network/ath9k_workaround_trigger similarity index 100% rename from gluon/gluon-ath9k-workaround/files/lib/gluon/announce/announce.d/network/ath9k_workaround_trigger rename to gluon/gluon-ath9k-workaround/files/lib/gluon/announce/statistics.d/network/ath9k_workaround_trigger diff --git a/gluon/gluon-autoupdater/files/lib/gluon/announce/announce.d/software/autoupdater b/gluon/gluon-autoupdater/files/lib/gluon/announce/nodeinfo.d/software/autoupdater similarity index 100% rename from gluon/gluon-autoupdater/files/lib/gluon/announce/announce.d/software/autoupdater rename to gluon/gluon-autoupdater/files/lib/gluon/announce/nodeinfo.d/software/autoupdater diff --git a/gluon/gluon-mesh-batman-adv/files/lib/gluon/announce/announce.d/network/addresses b/gluon/gluon-mesh-batman-adv/files/lib/gluon/announce/nodeinfo.d/network/addresses similarity index 100% rename from gluon/gluon-mesh-batman-adv/files/lib/gluon/announce/announce.d/network/addresses rename to gluon/gluon-mesh-batman-adv/files/lib/gluon/announce/nodeinfo.d/network/addresses diff --git a/gluon/gluon-mesh-batman-adv/files/lib/gluon/announce/announce.d/network/mesh_interfaces b/gluon/gluon-mesh-batman-adv/files/lib/gluon/announce/nodeinfo.d/network/mesh_interfaces similarity index 100% rename from gluon/gluon-mesh-batman-adv/files/lib/gluon/announce/announce.d/network/mesh_interfaces rename to gluon/gluon-mesh-batman-adv/files/lib/gluon/announce/nodeinfo.d/network/mesh_interfaces diff --git a/gluon/gluon-mesh-batman-adv/files/lib/gluon/announce/announce.d/software/batman-adv b/gluon/gluon-mesh-batman-adv/files/lib/gluon/announce/nodeinfo.d/software/batman-adv similarity index 100% rename from gluon/gluon-mesh-batman-adv/files/lib/gluon/announce/announce.d/software/batman-adv rename to gluon/gluon-mesh-batman-adv/files/lib/gluon/announce/nodeinfo.d/software/batman-adv diff --git a/gluon/gluon-mesh-batman-adv/files/lib/gluon/announce/announce.d/network/gateway b/gluon/gluon-mesh-batman-adv/files/lib/gluon/announce/statistics.d/gateway similarity index 100% rename from gluon/gluon-mesh-batman-adv/files/lib/gluon/announce/announce.d/network/gateway rename to gluon/gluon-mesh-batman-adv/files/lib/gluon/announce/statistics.d/gateway diff --git a/gluon/gluon-mesh-batman-adv/files/lib/gluon/announce/announce.d/statistics/traffic b/gluon/gluon-mesh-batman-adv/files/lib/gluon/announce/statistics.d/traffic similarity index 100% rename from gluon/gluon-mesh-batman-adv/files/lib/gluon/announce/announce.d/statistics/traffic rename to gluon/gluon-mesh-batman-adv/files/lib/gluon/announce/statistics.d/traffic diff --git a/gluon/gluon-mesh-vpn-fastd/files/lib/gluon/announce/announce.d/software/fastd b/gluon/gluon-mesh-vpn-fastd/files/lib/gluon/announce/nodeinfo.d/software/fastd similarity index 100% rename from gluon/gluon-mesh-vpn-fastd/files/lib/gluon/announce/announce.d/software/fastd rename to gluon/gluon-mesh-vpn-fastd/files/lib/gluon/announce/nodeinfo.d/software/fastd diff --git a/gluon/gluon-node-info/files/lib/gluon/announce/announce.d/location b/gluon/gluon-node-info/files/lib/gluon/announce/nodeinfo.d/location similarity index 100% rename from gluon/gluon-node-info/files/lib/gluon/announce/announce.d/location rename to gluon/gluon-node-info/files/lib/gluon/announce/nodeinfo.d/location diff --git a/gluon/gluon-node-info/files/lib/gluon/announce/announce.d/owner b/gluon/gluon-node-info/files/lib/gluon/announce/nodeinfo.d/owner similarity index 100% rename from gluon/gluon-node-info/files/lib/gluon/announce/announce.d/owner rename to gluon/gluon-node-info/files/lib/gluon/announce/nodeinfo.d/owner