mirror of
https://github.com/viq/NewsBlur.git
synced 2025-09-18 21:43:31 +00:00
fix netdata in docker and add timer charts
This commit is contained in:
parent
c96daac120
commit
de03cc6d36
3 changed files with 26 additions and 10496 deletions
|
@ -1,4 +1,4 @@
|
||||||
version: '2'
|
version: '3'
|
||||||
services:
|
services:
|
||||||
|
|
||||||
newsblur_web:
|
newsblur_web:
|
||||||
|
@ -79,11 +79,11 @@ services:
|
||||||
environment:
|
environment:
|
||||||
- POSTGRES_USER=newsblur
|
- POSTGRES_USER=newsblur
|
||||||
- POSTGRES_PASSWORD=newsblur
|
- POSTGRES_PASSWORD=newsblur
|
||||||
# healthcheck:
|
healthcheck:
|
||||||
# test: ["CMD-SHELL", "pg_isready -U postgres"]
|
test: ["CMD-SHELL", "pg_isready -U postgres"]
|
||||||
# interval: 10s
|
interval: 10s
|
||||||
# timeout: 5s
|
timeout: 5s
|
||||||
# retries: 5
|
retries: 5
|
||||||
ports:
|
ports:
|
||||||
- 5434:5432
|
- 5434:5432
|
||||||
volumes:
|
volumes:
|
||||||
|
@ -173,8 +173,7 @@ services:
|
||||||
volumes:
|
volumes:
|
||||||
- ./docker/netdata/netdatalib:/var/lib/netdata
|
- ./docker/netdata/netdatalib:/var/lib/netdata
|
||||||
- ./docker/netdata/netdatacache:/var/cache/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/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/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
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
from bases.FrameworkServices.SimpleService import SimpleService
|
from bases.FrameworkServices.SimpleService import SimpleService
|
||||||
import os
|
import os
|
||||||
import requests
|
import requests
|
||||||
|
import time
|
||||||
|
|
||||||
requests.packages.urllib3.disable_warnings()
|
requests.packages.urllib3.disable_warnings()
|
||||||
MONITOR_URL = os.getenv("MONITOR_URL")
|
MONITOR_URL = os.getenv("MONITOR_URL")
|
||||||
|
@ -32,7 +33,7 @@ class Service(SimpleService):
|
||||||
self.context = self.configuration.get("context")
|
self.context = self.configuration.get("context")
|
||||||
self.chart_type = self.configuration.get("type", "line")
|
self.chart_type = self.configuration.get("type", "line")
|
||||||
self.order = [
|
self.order = [
|
||||||
self.configuration.get("chart_name")
|
self.configuration.get("chart_name"), "data retrieval time"
|
||||||
]
|
]
|
||||||
self.monitor_data = call_monitor(self.endpoint)
|
self.monitor_data = call_monitor(self.endpoint)
|
||||||
self.definitions = {
|
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
|
'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
|
'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
|
@staticmethod
|
||||||
def check():
|
def check():
|
||||||
|
@ -50,7 +54,11 @@ class Service(SimpleService):
|
||||||
|
|
||||||
def get_data(self):
|
def get_data(self):
|
||||||
data = {}
|
data = {}
|
||||||
|
start = time.time()
|
||||||
api_data = call_monitor(self.endpoint)
|
api_data = call_monitor(self.endpoint)
|
||||||
|
end = time.time()
|
||||||
|
|
||||||
|
retrieval_time = end - start
|
||||||
|
|
||||||
for dimension_id in api_data.keys():
|
for dimension_id in api_data.keys():
|
||||||
|
|
||||||
|
@ -59,4 +67,10 @@ class Service(SimpleService):
|
||||||
|
|
||||||
data[dimension_id] = api_data[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
|
return data
|
||||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue