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