fixing problems with data formatting in apache and nginx
paulfantom committed
Jun 22, 2016 at 17:55 UTC
923e9b871e6134578f781d5fc87f98f1c5428d0a
4 files changed
+19
-16
charts.d/apache.chart.sh
+1
-1
@@ -238,7 +238,7 @@ SET connections = $((apache_connstotal))
238
END
239
BEGIN apache.conns_async $1
240
SET keepalive = $((apache_connsasynckeepalive))
241
-SET closing = $((apache_connsasyncwriting))
241
+SET closing = $((apache_connsasyncclosing))
242
SET writing = $((apache_connsasyncwriting))
243
END
244
VALUESEOF2
python.d/apache.chart.py
+7
-4
@@ -18,14 +18,14 @@ retries = 5
18
# }}
19
20
# charts order (can be overridden if you want less charts, or different order)
21
-ORDER = ['bytesperreq', 'workers', 'reqpersec', 'bytespersec', 'requests', 'net', 'connections', 'conns_async']
21
+ORDER = ['requests', 'connections', 'conns_async', 'net', 'workers', 'reqpersec', 'bytespersec', 'bytesperreq']
22
23
CHARTS = {
24
'bytesperreq': {
25
'options': "'' 'apache Lifetime Avg. Response Size' 'bytes/request' statistics apache.bytesperreq area",
26
'lines': [
27
{"name": "size_req",
28
- "options": "'' absolute 1"}
28
+ "options": "'' absolute 1 1000000"}
29
]},
30
'workers': {
31
'options': "'' 'apache Workers' 'workers' workers apache.workers stacked",
@@ -42,7 +42,7 @@ CHARTS = {
42
"options": "'' absolute 1 1000000"}
43
]},
44
'bytespersec': {
45
- 'options': "'' 'apache Lifetime Avg. Response Size' 'bytes/request' statistics apache.bytesperreq area",
45
+ 'options': "'' 'apache Lifetime Avg. Bandwidth/s' 'kilbits/s' statistics apache.bytesperreq area",
46
'lines': [
47
{"name": "size_sec",
48
"options": "'' absolute 8 1000000000"}
@@ -108,7 +108,10 @@ class Service(UrlService):
108
tmp = row.split(":")
109
if str(tmp[0]) in self.assignment:
110
try:
111
- data[self.assignment[tmp[0]]] = int(float(tmp[1]))
111
+ multiplier = 1
112
+ if tmp[0] in ("BytesPerReq", "ReqPerSec", "BytesPerSec"):
113
+ multiplier = 1000
114
+ data[self.assignment[tmp[0]]] = int(float(tmp[1])*multiplier)
115
except (IndexError, ValueError) as a:
116
print(a)
117
pass
python.d/nginx.chart.py
+7
-7
@@ -41,13 +41,13 @@ CHARTS = {
41
{"name": "writing",
42
"options": "'' absolute 1 1"},
43
{"name": "waiting",
44
- "options": "'' absolute 1 1"}
44
+ "options": "idle absolute 1 1"}
45
]},
46
'connect_rate': {
47
'options': "'' 'nginx Connections Rate' 'connections/s' nginx nginx.performance line",
48
'lines': [
49
{"name": "accepts",
50
- "options": "'accepted' incremental 1 1"},
50
+ "options": "accepted incremental 1 1"},
51
{"name": "handled",
52
"options": "'' incremental 1 1"}
53
]}
@@ -71,10 +71,10 @@ class Service(UrlService):
71
try:
72
return {'active': int(raw[2]),
73
'requests': int(raw[7]),
74
- 'reading': int(raw[8]),
75
- 'writing': int(raw[9]),
76
- 'waiting': int(raw[11]),
77
- 'accepts': int(raw[13]),
78
- 'handled': int(raw[15])}
74
+ 'reading': int(raw[11]),
75
+ 'writing': int(raw[13]),
76
+ 'waiting': int(raw[15]),
77
+ 'accepts': int(raw[8]),
78
+ 'handled': int(raw[9])}
79
except ValueError:
80
return None
web/index.html
+4
-4
@@ -1366,7 +1366,7 @@ var menuData = {
1366
info: undefined,
1367
},
1368
1369
- 'nginx': {
1369
+/* 'nginx': {
1370
title: 'nginx',
1371
info: undefined,
1372
},
@@ -1374,7 +1374,7 @@ var menuData = {
1374
'apache': {
1375
title: 'Apache',
1376
info: undefined,
1377
- },
1377
+ },*/
1378
1379
'named': {
1380
title: 'named',
@@ -1816,8 +1816,8 @@ function enrichChartData(chart) {
1816
1817
case 'mysql':
1818
case 'phpfpm':
1819
- case 'nginx':
1820
- case 'apache':
1819
+/* case 'nginx':
1820
+ case 'apache':*/
1821
case 'named':
1822
case 'cgroup':
1823
chart.menu = chart.type;