summaryrefslogtreecommitdiff
path: root/files/munin/lighttpd_
blob: 5862ee9f01165c87ceed8c764f7bc3afc8dcd786 (plain)
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
#!/usr/bin/python

# Idea from http://thelabmill.de/index.php/92
# adapted and splitted into submodules by
# immerda project group <admin+munin(at)immerda.ch>
# GPLv3

import sys
kind = sys.argv[0].replace('lighttpd_', '')
if kind == "total_accesses":
	graph_title = "Total Accesses"
	graph_type = "DERIVE"
	graph_vlabel = "Handled Requests"
elif kind == "total_kbytes":
	graph_title = "Total KBytes"
	graph_type = "DERIVE"
	graph_vlabel = "Transferred KBytes"
elif kind == "uptime":
	graph_title = "Uptime"
	graph_type = "DERIVE"
	graph_vlabel = "uptime in seconds"
elif kind == "busyservers":
	graph_title = "Busy Servers"
	graph_type = "GAUGE"
	graph_vlabel = "amount of busyservers"


if len(sys.argv) == 2 and sys.argv[1] == "autoconf":
        print "yes"
elif len(sys.argv) == 2 and sys.argv[1] == "config":
        print "graph_title Lighttpd Stats - " + graph_title
        print 'graph_vlabel ' + graph_vlabel
        print 'graph_category lighttpd'
        print kind+'.type ' + graph_type

        print 'graph_args --base 1000'
else:
   import urllib2
   f = urllib2.urlopen('http://127.0.0.1/server-status?auto')
   content = f.read()
   f.close()
   for temp in content.lower().splitlines():
       temp = temp.replace(" ", "_")
       temp = temp.replace(":_", ".value ")
       if temp.find(kind) >= 0:
            print temp