mirror of
https://github.com/munin-monitoring/contrib.git
synced 2018-11-08 00:59:34 +01:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
3842461477
@ -4,12 +4,10 @@
|
|||||||
#
|
#
|
||||||
# Munin plugin to show the network I/O per vm
|
# Munin plugin to show the network I/O per vm
|
||||||
#
|
#
|
||||||
# Copyright Maxence Dunnewind, Rodolphe Quiédeville
|
# Copyright Igor Borodikhin
|
||||||
#
|
#
|
||||||
# License : GPLv3
|
# License : GPLv3
|
||||||
#
|
#
|
||||||
# need to be run with root privilege to execute brctl
|
|
||||||
#
|
|
||||||
#
|
#
|
||||||
# parsed environment variables:
|
# parsed environment variables:
|
||||||
# vmsuffix: part of vm name to be removed
|
# vmsuffix: part of vm name to be removed
|
||||||
@ -58,22 +56,18 @@ def fetch(vms):
|
|||||||
''' Fetch values for a list of pids
|
''' Fetch values for a list of pids
|
||||||
@param dictionnary {kvm_pid: cleaned vm name}
|
@param dictionnary {kvm_pid: cleaned vm name}
|
||||||
'''
|
'''
|
||||||
macs = find_vms_tap()
|
|
||||||
res = {}
|
res = {}
|
||||||
for pid in vms:
|
for pid in vms:
|
||||||
mac = get_vm_mac(pid)
|
tap = get_vm_mac(pid)
|
||||||
try:
|
try:
|
||||||
tap = "tap%s" % macs[mac]
|
f = open("/proc/net/dev", "r")
|
||||||
f = open("/proc/net/dev", "r")
|
for line in f.readlines():
|
||||||
for line in f.readlines():
|
if tap in line:
|
||||||
if tap in line:
|
print "%s_in.value %s" % (vms[pid], re.sub(r"%s:"%tap, "", line.split()[0]))
|
||||||
line = line.split(':')[1]
|
print "%s_out.value %s" % (vms[pid], line.split()[8])
|
||||||
print "%s_in.value %s" % (vms[pid], line.split()[0])
|
break
|
||||||
print "%s_out.value %s" % (vms[pid], line.split()[8])
|
except Exception as inst:
|
||||||
break
|
print inst
|
||||||
else:
|
|
||||||
f.close()
|
|
||||||
except:
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
def detect_kvm():
|
def detect_kvm():
|
||||||
@ -98,7 +92,8 @@ def get_vm_mac(pid):
|
|||||||
@return the mac address for a specified pid
|
@return the mac address for a specified pid
|
||||||
'''
|
'''
|
||||||
cmdline = open("/proc/%s/cmdline" % pid, "r")
|
cmdline = open("/proc/%s/cmdline" % pid, "r")
|
||||||
mac = re.sub(r"^.*macaddr=(..:..:..:..:..:..).*$",r"\1", cmdline.readline())
|
line = cmdline.readline()
|
||||||
|
mac = re.sub(r"^.*ifname=(tap[^,]+),.*$",r"\1", line)
|
||||||
return mac
|
return mac
|
||||||
|
|
||||||
def list_pids():
|
def list_pids():
|
||||||
@ -112,16 +107,21 @@ def find_vms_tap():
|
|||||||
''' Check if kvm is installed
|
''' Check if kvm is installed
|
||||||
@return a list of pids from running kvm
|
@return a list of pids from running kvm
|
||||||
'''
|
'''
|
||||||
result = {}
|
result = []
|
||||||
kvm = Popen("brctl showmacs br0 | grep no", shell=True, stdout=PIPE)
|
tap = ""
|
||||||
|
mac = ""
|
||||||
|
kvm = Popen("ip a | grep -A 1 tap | awk '{print $2}' | grep -v '^$'", shell=True, stdout=PIPE)
|
||||||
res = kvm.communicate()[0].split('\n')
|
res = kvm.communicate()[0].split('\n')
|
||||||
for line in res:
|
for line in res:
|
||||||
try:
|
try:
|
||||||
tap = str(int(line.split()[0]) - 1)
|
if len(line) > 0:
|
||||||
mac = line.split()[1]
|
if re.match(r"^tap.*", line):
|
||||||
result[mac] = tap
|
tap = re.sub(r"(tap[^:]+):", r"\1", line)
|
||||||
except:
|
else:
|
||||||
|
result.append(tap)
|
||||||
|
except Exception as inst:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
64
plugins/voldemort/voldemort
Normal file
64
plugins/voldemort/voldemort
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
#!/usr/bin/env jruby
|
||||||
|
|
||||||
|
# Description: Voldemort plugin to pull basic stats on throughput and number of calls into Munin
|
||||||
|
# Author: Peter Crossley - Webtrends Inc
|
||||||
|
|
||||||
|
require 'rubygems'
|
||||||
|
require 'jmx4r'
|
||||||
|
|
||||||
|
|
||||||
|
#%# family=auto
|
||||||
|
#%# capabilities=autoconf
|
||||||
|
|
||||||
|
# friendly name => result of listPerfStatsKeys via JMX
|
||||||
|
keys = {
|
||||||
|
"Throughput" => { "vlabel" => "rate",
|
||||||
|
"type" => "ABSOLUTE",
|
||||||
|
"values" => ["all_operation_throughput","delete_throughput", "get_all_throughput", "get_throughput", "put_throughput"]
|
||||||
|
},
|
||||||
|
"Number of Calls" => { "vlabel" => "counts",
|
||||||
|
"type" => "COUNTER",
|
||||||
|
"values" => ["number_of_calls_to_delete","number_of_calls_to_get", "number_of_calls_to_get_all",
|
||||||
|
"number_of_calls_to_put", "number_of_exceptions"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ARGV[0] == "config"
|
||||||
|
keys.each_key do |key|
|
||||||
|
puts "multigraph voldemort_#{key.gsub(" ", "_")}"
|
||||||
|
puts "graph_title #{key}"
|
||||||
|
puts "graph_scale no"
|
||||||
|
puts "graph_category voldemort"
|
||||||
|
puts "graph_vlabel #{keys[key]['vlabel']}"
|
||||||
|
for data in keys[key]['values'] do
|
||||||
|
puts "#{data}.type #{keys[key]['type']}"
|
||||||
|
puts "#{data}.label #{data.gsub("_", " ")}"
|
||||||
|
end
|
||||||
|
puts
|
||||||
|
end
|
||||||
|
exit 0
|
||||||
|
elsif ARGV[0] == "autoconf"
|
||||||
|
puts "yes"
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
|
||||||
|
# Add JMX port
|
||||||
|
# JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=5400 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false"
|
||||||
|
# Tell JBossAS to use the platform MBean server
|
||||||
|
# JAVA_OPTS="$JAVA_OPTS -Djboss.platform.mbeanserver"
|
||||||
|
# Make the platform MBean server able to work with JBossAS MBeans
|
||||||
|
# JAVA_OPTS="$JAVA_OPTS -Djavax.management.builder.initial=org.jboss.system.server.jmx.MBeanServerBuilderImpl"
|
||||||
|
# JBOSS_CLASSPATH="/opt/webtrends/jboss/bin/mbean"
|
||||||
|
JMX::MBean.establish_connection :port => 5400
|
||||||
|
vs = JMX::MBean.find_by_name "voldemort.store.stats.aggregate:type=aggregate-perf"
|
||||||
|
|
||||||
|
keys.each_key do |key|
|
||||||
|
puts "multigraph voldemort_#{key.gsub(" ", "_")}"
|
||||||
|
for data in keys[key]['values'] do
|
||||||
|
puts "#{data}.value #{begin vs.send("#{data}") rescue 0 end}"
|
||||||
|
end
|
||||||
|
puts
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/local/bin/python
|
#!/usr/bin/env python
|
||||||
"""
|
"""
|
||||||
munin US NOAA weather plugin (http://weather.noaa.gov)
|
munin US NOAA weather plugin (http://weather.noaa.gov)
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/local/bin/python
|
#!/usr/bin/env python
|
||||||
"""
|
"""
|
||||||
munin US NOAA weather plugin (http://weather.noaa.gov)
|
munin US NOAA weather plugin (http://weather.noaa.gov)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user