]> arthur.barton.de Git - netdata.git/blob - python.d/example.chart.py
Merge pull request #1963 from ktsaou/master
[netdata.git] / python.d / example.chart.py
1 # -*- coding: utf-8 -*-
2 # Description: example netdata python.d module
3 # Author: Pawel Krupa (paulfantom)
4
5 import os
6 import random
7 from base import SimpleService
8
9 NAME = os.path.basename(__file__).replace(".chart.py", "")
10
11 # default module values
12 # update_every = 4
13 priority = 90000
14 retries = 60
15
16
17 class Service(SimpleService):
18     def __init__(self, configuration=None, name=None):
19         super(self.__class__,self).__init__(configuration=configuration, name=name)
20
21     def check(self):
22         return True
23     
24     def create(self):
25         self.chart("example.python_random", '', 'A random number', 'random number',
26                    'random', 'random', 'line', self.priority, self.update_every)
27         self.dimension('random1')
28         self.commit()
29         return True
30     
31     def update(self, interval):
32         self.begin("example.python_random", interval)
33         self.set("random1", random.randint(0, 100))
34         self.end()
35         self.commit()
36         return True