mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-22 14:16:00 +00:00
Plugin lighttpd_: fix code style issues reported by flake8
This commit is contained in:
parent
8b24b64960
commit
5b8adb5844
2 changed files with 75 additions and 49 deletions
|
@ -1,73 +1,100 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: set fileencoding=utf-8
|
# vim: set fileencoding=utf-8
|
||||||
#
|
"""
|
||||||
# Munin plugin to monitor lighttpd web-server.
|
|
||||||
#
|
=head1 NAME
|
||||||
# Copyright Igor Borodikhin
|
|
||||||
#
|
Munin plugin to monitor lighttpd web-server.
|
||||||
# License : GPLv3
|
|
||||||
#
|
|
||||||
# Configuration parameters:
|
=head1 CONFIGURATION
|
||||||
# env.status_url - url of lighty's server-status (optional, default is http://127.0.0.1/server-status)
|
|
||||||
# env.username - username to provide if status_url requires authentication (optional, default - no authentication)
|
Configuration parameters:
|
||||||
# env.password - password to provide if status_url requires authentication (optional, default - no authentication)
|
|
||||||
# env.auth_type - the authentication mechanism to use -- either 'basic' (default) or 'digest'.
|
[lighttpd_]
|
||||||
#
|
env.status_url - url of lighty's server-status
|
||||||
# Note: If HTTP authentication is required you should specify both username and password.
|
(optional, default is http://127.0.0.1/server-status)
|
||||||
#
|
env.username - username to provide if status_url requires authentication
|
||||||
# ## Installation
|
(optional, default - no authentication)
|
||||||
# Copy file to directory /usr/share/munin/plugins/
|
env.password - password to provide if status_url requires authentication
|
||||||
# Because this plugin has suggest capability the last step is to run
|
(optional, default - no authentication)
|
||||||
# # munin-node-configure --suggest --shell | sh -x
|
env.auth_type - the authentication mechanism to use -- either 'basic' (default) or 'digest'.
|
||||||
#
|
|
||||||
#%# family=contrib
|
Note: If HTTP authentication is required you should specify both username and password.
|
||||||
#%# capabilities=autoconf suggest
|
|
||||||
|
|
||||||
|
=head1 INSTALLTION
|
||||||
|
|
||||||
|
Copy file to directory /usr/share/munin/plugins/
|
||||||
|
Because this plugin has "suggest" capability the last step is to run
|
||||||
|
|
||||||
|
munin-node-configure --suggest --shell | sh -x
|
||||||
|
|
||||||
|
|
||||||
|
=head1 AUTHOR
|
||||||
|
|
||||||
|
Copyright Igor Borodikhin
|
||||||
|
|
||||||
|
|
||||||
|
=head1 LICENSE
|
||||||
|
|
||||||
|
GPLv3
|
||||||
|
|
||||||
|
|
||||||
|
=head1 MAGIC MARKERS
|
||||||
|
#%# family=contrib
|
||||||
|
#%# capabilities=autoconf suggest
|
||||||
|
"""
|
||||||
|
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import urllib2
|
||||||
|
|
||||||
import os, sys, urllib2
|
|
||||||
|
|
||||||
program = sys.argv[0]
|
program = sys.argv[0]
|
||||||
graph_type = program[program.rfind("_")+1:]
|
graph_type = program[program.rfind("_")+1:]
|
||||||
graph_types = {
|
graph_types = {
|
||||||
"accesses" : [
|
"accesses": [
|
||||||
{
|
{
|
||||||
"title" : "Total accesses",
|
"title": "Total accesses",
|
||||||
"type" : "COUNTER",
|
"type": "COUNTER",
|
||||||
"args" : "--base 1000 -l 0",
|
"args": "--base 1000 -l 0",
|
||||||
"fields" : ["accesses"]
|
"fields": ["accesses"]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"kbytes" : [
|
"kbytes": [
|
||||||
{
|
{
|
||||||
"title" : "Total kBytes",
|
"title": "Total kBytes",
|
||||||
"type" : "COUNTER",
|
"type": "COUNTER",
|
||||||
"args" : "--base 1024 -l 0",
|
"args": "--base 1024 -l 0",
|
||||||
"fields" : ["kbytes"]
|
"fields": ["kbytes"]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"uptime" : [
|
"uptime": [
|
||||||
{
|
{
|
||||||
"title" : "Uptime",
|
"title": "Uptime",
|
||||||
"type" : "GAUGE",
|
"type": "GAUGE",
|
||||||
"args" : "--base 1000 -l 0",
|
"args": "--base 1000 -l 0",
|
||||||
"fields" : ["uptime"]
|
"fields": ["uptime"]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"status" : [
|
"status": [
|
||||||
{
|
{
|
||||||
"title" : "Status",
|
"title": "Status",
|
||||||
"type" : "GAUGE",
|
"type": "GAUGE",
|
||||||
"args" : "--base 1000 -l 0",
|
"args": "--base 1000 -l 0",
|
||||||
"fields" : ["busy", "idle"]
|
"fields": ["busy", "idle"]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if len(sys.argv) == 2 and sys.argv[1] == "autoconf":
|
if len(sys.argv) == 2 and sys.argv[1] == "autoconf":
|
||||||
print "yes"
|
print "yes"
|
||||||
elif len(sys.argv) == 2 and sys.argv[1] == "config":
|
elif len(sys.argv) == 2 and sys.argv[1] == "config":
|
||||||
if graph_type not in graph_types.keys():
|
if graph_type not in graph_types.keys():
|
||||||
raise Exception("Unknown graph type '%s'"%graph_type)
|
raise Exception("Unknown graph type '%s'" % graph_type)
|
||||||
params = graph_types[graph_type]
|
params = graph_types[graph_type]
|
||||||
for item in params:
|
for item in params:
|
||||||
print "graph_title %s" % item["title"]
|
print "graph_title %s" % item["title"]
|
||||||
|
@ -98,7 +125,7 @@ else:
|
||||||
try:
|
try:
|
||||||
(title, value) = line.split(": ")
|
(title, value) = line.split(": ")
|
||||||
data[title] = value
|
data[title] = value
|
||||||
except Exception:
|
except ValueError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if graph_type == "accesses":
|
if graph_type == "accesses":
|
||||||
|
|
|
@ -175,7 +175,6 @@ plugins/libvirt/kvm_io
|
||||||
plugins/libvirt/kvm_mem
|
plugins/libvirt/kvm_mem
|
||||||
plugins/libvirt/kvm_net
|
plugins/libvirt/kvm_net
|
||||||
plugins/libvirt/munin-libvirtpy
|
plugins/libvirt/munin-libvirtpy
|
||||||
plugins/lighttpd/lighttpd_
|
|
||||||
plugins/logins/logins
|
plugins/logins/logins
|
||||||
plugins/logs/service_events
|
plugins/logs/service_events
|
||||||
plugins/lxc/lxc_cpu
|
plugins/lxc/lxc_cpu
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue