]> arthur.barton.de Git - netdata.git/blob - python.d/example.chart.py
python2 compatibility
[netdata.git] / python.d / example.chart.py
1 # Description: example netdata python.d plugin
2 # Author: Pawel Krupa (paulfantom)
3
4 import random
5 from base import BaseService
6
7 NAME = "example.chart.py"
8 # default module values
9 update_every = 3
10 priority = 90000
11 retries = 7
12
13
14 class Service(BaseService):
15     def __init__(self, configuration=None, name=None):
16         super(self.__class__,self).__init__(configuration=configuration)
17
18     def check(self):
19         return True
20     
21     def create(self):
22         print("CHART example.python_random '' 'A random number' 'random number' random random line "+str(self.priority)+" "+str(self.update_every))
23         print("DIMENSION random1 '' absolute 1 1")
24         return True
25     
26     def update(self, interval):
27         print("BEGIN example.python_random "+str(interval))
28         print("SET random1 = "+str(random.randint(0,100)))
29         print("END")
30         return True