mirror of
https://github.com/netdata/netdata.git
synced 2025-04-18 03:23:51 +00:00

* apache units fix * beanstalk * bind_rndc * boinc * ceph * chrony * couchdb * dns_query * dnsdist * dockerd * dovecot * elasticsearch by @vlvkobal <3 * example * exim * fail2ban * freeradius minor fixes * freeradius minor fixes * freeradius minor fixes * go_expvar * haproxy * hddtemp * httpcheck * icecast * ipfs * isc_dhcpd * litespeed * logind * megacli * memcached * mongodb * monit * mysql * nginx * nginx_plus * nsd * ntpd * nvidia_smi * openldap * ovpn_status * phpfm * portcheck * postfix * postgres * powerdns * proxysql * puppet * rabbitmq * redis * restroshare * samba * sensors * smartdlog * spigotmc * springboot * squid * retroshare * tomcat * retroshare * tor * traefik * traefik * unbound * uwsgi * varnish * w1sensor * web_log * ok codacy * retroshare * ipfs
49 lines
1.1 KiB
Python
49 lines
1.1 KiB
Python
# -*- coding: utf-8 -*-
|
|
# Description: example netdata python.d module
|
|
# Author: Put your name here (your github login)
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
from random import SystemRandom
|
|
|
|
from bases.FrameworkServices.SimpleService import SimpleService
|
|
|
|
|
|
priority = 90000
|
|
|
|
ORDER = [
|
|
'random',
|
|
]
|
|
|
|
CHARTS = {
|
|
'random': {
|
|
'options': [None, 'A random number', 'random number', 'random', 'random', 'line'],
|
|
'lines': [
|
|
['random1']
|
|
]
|
|
}
|
|
}
|
|
|
|
|
|
class Service(SimpleService):
|
|
def __init__(self, configuration=None, name=None):
|
|
SimpleService.__init__(self, configuration=configuration, name=name)
|
|
self.order = ORDER
|
|
self.definitions = CHARTS
|
|
self.random = SystemRandom()
|
|
|
|
@staticmethod
|
|
def check():
|
|
return True
|
|
|
|
def get_data(self):
|
|
data = dict()
|
|
|
|
for i in range(1, 4):
|
|
dimension_id = ''.join(['random', str(i)])
|
|
|
|
if dimension_id not in self.charts['random']:
|
|
self.charts['random'].add_dimension([dimension_id])
|
|
|
|
data[dimension_id] = self.random.randint(0, 100)
|
|
|
|
return data
|