updated example module
paulfantom committed
Jun 18, 2016 at 13:54 UTC
31e93ffe7c42159bf6d6997ea3ffdf4b548f9be2
1 file changed
+26
-13
python.d/example.chart.py
+26
-13
@@ -1,18 +1,31 @@
1
+# Description: example netdata python.d plugin
2
+# Author: Pawel Krupa (paulfantom)
3
+
4
+NAME = "example.chart.py"
5
+import sys
6
import random
7
+from base import BaseService
8
3
-update_every = 5
4
-priority = 150000
9
+# default module values
10
+update_every = 3
11
+priority = 90000
12
+retries = 7
13
6
-def check():
7
- return True
14
9
-def create():
10
- print("CHART example.python_random '' 'A random number' 'random number' random random line "+str(priority)+" 1")
11
- print("DIMENSION random1 '' absolute 1 1")
12
- return True
15
+class Service(BaseService):
16
+ def __init__(self,configuration=None,name=None):
17
+ super().__init__(configuration=configuration)
18
14
-def update(interval):
15
- print("BEGIN example.python_random "+str(interval))
16
- print("SET random1 = "+str(random.randint(0,100)))
17
- print("END")
18
- return True
19
+ def check(self):
20
+ return True
21
+
22
+ def create(self):
23
+ print("CHART example.python_random '' 'A random number' 'random number' random random line "+str(priority)+" 1")
24
+ print("DIMENSION random1 '' absolute 1 1")
25
+ return True
26
+
27
+ def update(self,interval):
28
+ print("BEGIN example.python_random "+str(interval))
29
+ print("SET random1 = "+str(random.randint(0,100)))
30
+ print("END")
31
+ return True