summaryrefslogtreecommitdiffstats
path: root/python.d/example.chart.py
diff options
context:
space:
mode:
authorLennart Weller <lhw@ring0.de>2016-09-05 08:27:26 +0000
committerLennart Weller <lhw@ring0.de>2016-09-05 08:27:26 +0000
commit58d9525d7fcacffe52eff7282b7a888dd0dcc1d0 (patch)
tree251a805eb38d4d75b2a7f44c2cc22e7ea4849513 /python.d/example.chart.py
parentFixes for service startup and extra config files (diff)
parentImported Upstream version 1.3.0+dfsg (diff)
downloadnetdata-58d9525d7fcacffe52eff7282b7a888dd0dcc1d0.tar.xz
netdata-58d9525d7fcacffe52eff7282b7a888dd0dcc1d0.zip
Merge tag 'upstream/1.3.0+dfsg'
Upstream version 1.3.0+dfsg
Diffstat (limited to 'python.d/example.chart.py')
-rw-r--r--python.d/example.chart.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/python.d/example.chart.py b/python.d/example.chart.py
new file mode 100644
index 00000000..adf97a92
--- /dev/null
+++ b/python.d/example.chart.py
@@ -0,0 +1,36 @@
+# -*- coding: utf-8 -*-
+# Description: example netdata python.d module
+# Author: Pawel Krupa (paulfantom)
+
+import os
+import random
+from base import SimpleService
+
+NAME = os.path.basename(__file__).replace(".chart.py", "")
+
+# default module values
+# update_every = 4
+priority = 90000
+retries = 60
+
+
+class Service(SimpleService):
+ def __init__(self, configuration=None, name=None):
+ super(self.__class__,self).__init__(configuration=configuration, name=name)
+
+ def check(self):
+ return True
+
+ def create(self):
+ self.chart("example.python_random", '', 'A random number', 'random number',
+ 'random', 'random', 'line', self.priority, self.update_every)
+ self.dimension('random1')
+ self.commit()
+ return True
+
+ def update(self, interval):
+ self.begin("example.python_random", interval)
+ self.set("random1", random.randint(0, 100))
+ self.end()
+ self.commit()
+ return True