fix netdata in docker and add timer charts

This commit is contained in:
Jonathan Math 2021-04-18 11:42:19 -05:00
parent c96daac120
commit de03cc6d36
3 changed files with 26 additions and 10496 deletions

View file

@ -1,4 +1,4 @@
version: '2'
version: '3'
services:
newsblur_web:
@ -79,11 +79,11 @@ services:
environment:
- POSTGRES_USER=newsblur
- POSTGRES_PASSWORD=newsblur
# healthcheck:
# test: ["CMD-SHELL", "pg_isready -U postgres"]
# interval: 10s
# timeout: 5s
# retries: 5
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5
ports:
- 5434:5432
volumes:
@ -173,8 +173,7 @@ services:
volumes:
- ./docker/netdata/netdatalib:/var/lib/netdata
- ./docker/netdata/netdatacache:/var/cache/netdata
- ./docker/netdata/netdataconfig/netdata.conf:/etc/netdata/netdata.conf
- ./docker/netdata/netdataconfig/netdata.conf.j2:/etc/netdata/netdata.conf
- ./docker/netdata/netdataconfig/python.d.conf:/usr/lib/netdata/conf.d/python.d.conf
- ./docker/netdata/netdataconfig/conf/:/usr/lib/netdata/conf.d/python.d/
- ./docker/netdata/netdataconfig/charts/newsblur.chart.py:/usr/libexec/netdata/python.d/newsblur.chart.py
- ./docker/netdata/netdataconfig/charts/newsblur.chart.py:/usr/libexec/netdata/python.d/newsblur.chart.py

View file

@ -1,6 +1,7 @@
from bases.FrameworkServices.SimpleService import SimpleService
import os
import requests
import time
requests.packages.urllib3.disable_warnings()
MONITOR_URL = os.getenv("MONITOR_URL")
@ -32,7 +33,7 @@ class Service(SimpleService):
self.context = self.configuration.get("context")
self.chart_type = self.configuration.get("type", "line")
self.order = [
self.configuration.get("chart_name")
self.configuration.get("chart_name"), "data retrieval time"
]
self.monitor_data = call_monitor(self.endpoint)
self.definitions = {
@ -41,8 +42,11 @@ class Service(SimpleService):
'options': [None, self.title, None, None, self.context, self.chart_type], # line indicates that it is a line graph
'lines': [[key] for key in self.monitor_data] #must be a valid key in 'get_data()'s return
},
"data retrieval time": {
'options': [None, self.title + "Data Retrieval Time", None, None, self.context, "line"], # line indicates that it is a line graph
'lines': [["seconds"]] #must be a valid key in 'get_data()'s return
}
# add a chart to calculate time that it takes to make the calls to monitor
}
@staticmethod
def check():
@ -50,7 +54,11 @@ class Service(SimpleService):
def get_data(self):
data = {}
start = time.time()
api_data = call_monitor(self.endpoint)
end = time.time()
retrieval_time = end - start
for dimension_id in api_data.keys():
@ -58,5 +66,11 @@ class Service(SimpleService):
self.charts[self.chart_name].add_dimension([dimension_id])
data[dimension_id] = api_data[dimension_id]
timer_chart = "data retrieval time"
if "seconds" not in self.charts[timer_chart]:
self.charts[timer_chart].add_dimension(["seconds"])
data["seconds"] = retrieval_time
return data

File diff suppressed because it is too large Load diff