2
0
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:
Artem Sheremet 2012-03-20 11:39:17 +03:00
commit 9dac1e3456
6 changed files with 123 additions and 11 deletions

View File

@ -0,0 +1,96 @@
#!/bin/bash
# -*- sh -*-
: << =cut
=head1 NAME
glassfish_counters_ - Wildcard-plugin to monitor counters in GlassFish
=head1 CONFIGURATION
This plugin does need the full path to the asadmin script:
[glassfish_counters_*]
env.ASADMIN /usr/local/glassfish/bin/asadmin
This is a wildcard plugin. To monitor an subtree, link
glassfish_counters_<subtree> to this file. E.g.
ln -s /usr/share/munin/plugins/glassfish_counters_ \
/etc/munin/plugins/glassfish_counters_server.web.request
...will monitor server.web.request.*
To ignore certain counters, just add more "IGNORE" lines on top of
the awk script. (XXX: Fixme for env.)
=head1 AUTHOR
Philipp Buehler
=head1 LICENSE
BSD 2-clause
=head1 VERSION
$Id: glassfish_counters_.in$
0.0.1
=cut
[ -z $ASADMIN ] && {
echo "ASADMIN not set in node configuration"
exit 1
} || MUN_AS_ADMIN=${ASADMIN}
check_link () {
scriptname=${0##*/}
myself=${scriptname##*_}
if [ "x$myself" = "x" ] ; then
echo "plugin must be symlinked, e.g. to glassfish_counters_server.web.request"
exit 1
fi
}
SUBTREE=${0##*glassfish_counters_}
case $1 in
suggest)
echo "not implemented"
exit 0
;;
config)
check_link
$MUN_AS_ADMIN get -t --monitor=true "${SUBTREE}.*" | \
awk 'BEGIN{ FS="[ = ]"}
/requestcount/ { next; } # IGNORE
/dotted-name/ { myself = $NF
print "graph_title GlassFish", myself
print "graph_vlabel count"
print "graph_category glassfish"
print "graph_info this shows available counters from", myself
next
}
/-name / { nwhat = split($1, what, ".")
gsub(/-name/, "", what[nwhat])
print what[nwhat] ".label " $NF
print what[nwhat] ".type GAUGE"
}
/-description / { nwhat = split($1, what, ".")
gsub(/-description/, "", what[nwhat])
$1 = ""; line = $0
gsub(/^ /,"", line)
print what[nwhat] ".info " line
}
'
exit 0
;;
esac
check_link
$MUN_AS_ADMIN get -t --monitor=true "${SUBTREE}.*" | \
awk 'BEGIN{ FS="[ = ]" }
/requestcount/ { next;} # IGNORE
/-count / { nwhat = split($1, what, ".")
gsub(/-count/, "", what[nwhat])
print what[nwhat] ".value=" $NF}
'

View File

@ -5,10 +5,10 @@
[instance:basic]
pluginprofile = basic
port = 4000
port = 4001
[pluginprofile:basic]
plugins = always_warning, always_critical, graph_area
plugins = graph_area
[base]
# when building an example config with --muninconf, what hostname to output.

View File

@ -0,0 +1,14 @@
#
# Quick estimate says 30 plugins is a good estimate for a common client.
#
[instance:huge]
pluginprofile = huge
portrange = 4000-4100
[pluginprofile:huge]
plugins = load, locks, load, locks, load, locks, load, locks, load, locks, load, locks, load, locks, load, locks ,load, locks, load, locks, load, locks, load, locks ,load, locks, load, locks, load, locks, load, locks
[base]
# when building an example config with --muninconf, what hostname to output.
hostname = localhost

View File

@ -264,7 +264,7 @@ def start_servers(instances):
def usage():
print "Usage: %s [--run] [--verbose] [--muninconf] <configfile>" % sys.argv[0]
print "Usage: %s [--run] [--verbose] [--muninconf] <configfile> <configfileN>" % sys.argv[0]
def main():
if len(sys.argv) <= 2:
@ -276,7 +276,12 @@ def main():
verbose = True
config = ConfigParser.RawConfigParser()
config.read(sys.argv[-1])
for configfile in sys.argv[1:]:
if not configfile.endswith(".conf"):
continue
if verbose:
print "Reading config file %s" % configfile
config.read(configfile)
instancekeys = [ key for key in config.sections() if key.startswith("instance:") ]
servers = {}
@ -330,14 +335,14 @@ def main():
instanceconfig[k] = v
instanceconfig["plugins"] = plugins
if "--verbose" in sys.argv:
instanceconfig["verbose"] = True
instanceconfig["verbose"] = verbose
instanceconfig["name"] = "%s-%s" % (instancename, portinstance)
instanceconfig["expanded_port"] = portinstance
instances.append(instanceconfig)
# XXX: need to store what handlers we should have.
print instances
# output sample munin config for the poller
if "--muninconf" in sys.argv:

View File

@ -5,7 +5,7 @@
[instance:notifications]
pluginprofile = notif
port = 3000
port = 4010
#
#[instance:baz]

View File

@ -3,14 +3,11 @@
[instance:tarpit]
pluginprofile = tarpit
port = 3000
port = 4005
[pluginprofile:tarpit]
plugins = load, locks, tarpit, load, locks
[pluginprofile:base]
plugins = load, locks, locks, load, load, locks, locks, load, load, load
[base]
# when building an example config with --muninconf, what hostname to output.
hostname = localhost