-
Notifications
You must be signed in to change notification settings - Fork 995
/
nginx_connections
executable file
·49 lines (45 loc) · 1.15 KB
/
nginx_connections
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env python
import os
import re
import urllib
from munin.nginx import MuninNginxPlugin
class MuninNginxConnectionsPlugin(MuninNginxPlugin):
title = "Nginx Connections"
args = "--base 1000"
vlabel = "Connections"
fields = (
('total', dict(
label = "Active connections",
type = "GAUGE",
draw = "LINE2",
min = "0",
)),
('reading', dict(
label = "Reading",
type = "GAUGE",
draw = "LINE2",
min = "0",
)),
('writing', dict(
label = "Writing",
type = "GAUGE",
draw = "LINE2",
min = "0",
)),
('waiting', dict(
label = "Waiting",
type = "GAUGE",
draw = "LINE2",
min = "0",
)),
)
def execute(self):
status = self.get_status()
return dict(
total = status['active'],
reading = status['reading'],
writing = status['writing'],
waiting = status['waiting'],
)
if __name__ == "__main__":
MuninNginxConnectionsPlugin().run()