]> arthur.barton.de Git - netdata.git/commitdiff
updated example module
authorpaulfantom <paulfantom@gmail.com>
Sat, 18 Jun 2016 11:54:10 +0000 (13:54 +0200)
committerpaulfantom <paulfantom@gmail.com>
Sat, 18 Jun 2016 11:54:10 +0000 (13:54 +0200)
python.d/example.chart.py

index ddda212a99b864b36dde56a488380b239eb5d526..b4a6ddadac3f2823223f826693eb4eff1dc514cc 100644 (file)
@@ -1,18 +1,31 @@
+# Description: example netdata python.d plugin
+# Author: Pawel Krupa (paulfantom)
+
+NAME = "example.chart.py"
+import sys
 import random
+from base import BaseService
 
-update_every = 5
-priority = 150000
+# default module values
+update_every = 3
+priority = 90000
+retries = 7
 
-def check():
-    return True
 
-def create():
-    print("CHART example.python_random '' 'A random number' 'random number' random random line "+str(priority)+" 1")
-    print("DIMENSION random1 '' absolute 1 1")
-    return True
+class Service(BaseService):
+    def __init__(self,configuration=None,name=None):
+        super().__init__(configuration=configuration)
 
-def update(interval):
-    print("BEGIN example.python_random "+str(interval))
-    print("SET random1 = "+str(random.randint(0,100)))
-    print("END")
-    return True
+    def check(self):
+        return True
+    
+    def create(self):
+        print("CHART example.python_random '' 'A random number' 'random number' random random line "+str(priority)+" 1")
+        print("DIMENSION random1 '' absolute 1 1")
+        return True
+    
+    def update(self,interval):
+        print("BEGIN example.python_random "+str(interval))
+        print("SET random1 = "+str(random.randint(0,100)))
+        print("END")
+        return True