litespeed: add network throughput charts
lgz committed
Jun 4, 2018 at 16:24 UTC
51e52878ace247be21ee68cb8ada09f5db54712d
1 file changed
+36
-12
python.d/litespeed.chart.py
+36
-12
@@ -14,32 +14,52 @@ from bases.FrameworkServices.SimpleService import SimpleService
14
update_every = 10
15
16
# charts order (can be overridden if you want less charts, or different order)
17
-ORDER = ['requests', 'pub_cache_hits', 'priv_cache_hits', 'static_hits']
17
+ORDER = [
18
+ 'net_throughput_http', 'net_throughput_https',
19
+ 'requests', 'pub_cache_hits', 'priv_cache_hits', 'static_hits']
20
21
CHARTS = {
22
+ 'net_throughput_http': {
23
+ 'options': [
24
+ None, 'Network Throughput HTTP', 'kilobytes/s', 'net throughput', 'litespeed.net_throughput', 'area'],
25
+ 'lines': [
26
+ ["bps_in", "in", "absolute"],
27
+ ["bps_out", "out", "absolute", -1]
28
+ ]},
29
+ 'net_throughput_https': {
30
+ 'options': [
31
+ None, 'Network Throughput HTTPS', 'kilobytes/s', 'net throughput', 'litespeed.net_throughput', 'area'],
32
+ 'lines': [
33
+ ["ssl_bps_in", "in", "absolute"],
34
+ ["ssl_bps_out", "out", "absolute", -1]
35
+ ]},
36
'requests': {
21
- 'options': [None, 'Requests', 'req/sec', 'requests', 'litespeed.requests', 'line'],
37
+ 'options': [None, 'Requests', 'req/s', 'requests', 'litespeed.requests', 'line'],
38
'lines': [
23
- ["requests", None, "incremental", 1, 100]
39
+ ["requests", None, "incremental"]
40
]},
41
'pub_cache_hits': {
26
- 'options': [None, 'Public Cache Hits', 'hits/sec', 'cache', 'litespeed.pub_cache', 'line'],
42
+ 'options': [None, 'Public Cache Hits', 'hits/s', 'cache', 'litespeed.pub_cache', 'line'],
43
'lines': [
28
- ["pub_cache_hits", "hits", "incremental", 1, 100]
44
+ ["pub_cache_hits", "hits", "incremental"]
45
]},
46
'priv_cache_hits': {
31
- 'options': [None, 'Private Cache Hits', 'hits/sec', 'cache', 'litespeed.priv_cache', 'line'],
47
+ 'options': [None, 'Private Cache Hits', 'hits/s', 'cache', 'litespeed.priv_cache', 'line'],
48
'lines': [
33
- ["priv_cache_hits", "hits", "incremental", 1, 100]
49
+ ["priv_cache_hits", "hits", "incremental"]
50
]},
51
'static_hits': {
36
- 'options': [None, 'Static Hits', 'hits/sec', 'static', 'litespeed.static', 'line'],
52
+ 'options': [None, 'Static Hits', 'hits/s', 'static', 'litespeed.static', 'line'],
53
'lines': [
38
- ["static_hits", "hits", "incremental", 1, 100]
54
+ ["static_hits", "hits", "incremental"]
55
]},
56
}
57
58
KEYS = [
59
+ ('BPS_IN', 'bps_in'),
60
+ ('BPS_OUT', 'bps_out'),
61
+ ('SSL_BPS_IN', 'ssl_bps_in'),
62
+ ('SSL_BPS_OUT', 'ssl_bps_out'),
63
('TOT_REQS', 'requests'),
64
('TOTAL_PUB_CACHE_HITS', 'pub_cache_hits'),
65
('TOTAL_PRIVATE_CACHE_HITS', 'priv_cache_hits'),
@@ -69,6 +89,10 @@ class Service(SimpleService):
89
self.path = self.configuration.get('path')
90
self.files = list()
91
self.data = {
92
+ "bps_in": 0,
93
+ "bps_out": 0,
94
+ "ssl_bps_in": 0,
95
+ "ssl_bps_out": 0,
96
"requests": 0,
97
"pub_cache_hits": 0,
98
"priv_cache_hits": 0,
@@ -123,12 +147,12 @@ class Service(SimpleService):
147
148
def parse_file(data, lines):
149
for line in lines:
126
- if not line.startswith("REQ_RATE []"):
150
+ if not line.startswith(("BPS_IN", "REQ_RATE []")):
151
continue
152
m = dict(RE.findall(line))
153
for k, d in KEYS:
130
- data[d] += float(m[k]) * 100 if k in m else 0
131
- break
154
+ if k in m:
155
+ data[d] += int(m[k])
156
157
158
def is_readable_file(v):