diff options
-rw-r--r-- | retiolum/scripts/adv_graphgen/tinc_stats/Graphite.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/retiolum/scripts/adv_graphgen/tinc_stats/Graphite.py b/retiolum/scripts/adv_graphgen/tinc_stats/Graphite.py index ee01a02b..5002d8e5 100644 --- a/retiolum/scripts/adv_graphgen/tinc_stats/Graphite.py +++ b/retiolum/scripts/adv_graphgen/tinc_stats/Graphite.py @@ -12,5 +12,13 @@ class GraphiteSender: self.sock.connect((host,port)) def send(name,data): - from time import time - self.sock.send("%s.%s %d %d\r\n"%self.prefix,data,time()) + # construct a message for graphite, honor the configured prefix + self.sock.send("%s.%s %d %d\r\n"%(self.prefix,name,data,time())) + + def send_raw(path,data): + #ignore the configured prefix, just it to the path given + self.sock.send("%s %d %d\r\n"%(path,data,time())) + +if __name__ == "__main__": + import sys + GraphiteSender(sys.argv[1]).send_raw(sys.argv[2],sys.argv[3]) |