summaryrefslogtreecommitdiffstats
path: root/retiolum/scripts/adv_graphgen/tinc_stats/Graphite.py
blob: ee01a02bd87b4453a97000ccc62f2e6e3cf960bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/python

import socket
from time import time

class GraphiteSender:
  def __init__(self,host,port=2003,prefix="retiolum"):
    self.host = host
    self.port = port
    self.prefix = prefix
    self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 
    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())