mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-21 18:41:03 +00:00
Add interrupts, forks, fsstat_bytes, fsstat_act_ plugins for Solaris
This commit is contained in:
parent
7a2eba747c
commit
726abac461
4 changed files with 591 additions and 0 deletions
112
plugins/solaris/forks
Executable file
112
plugins/solaris/forks
Executable file
|
@ -0,0 +1,112 @@
|
|||
#!/bin/bash
|
||||
|
||||
: << =cut
|
||||
|
||||
=head1 NAME
|
||||
|
||||
forks - Munin plugin to monitor Solaris fork and exec rate
|
||||
|
||||
=head1 CONFIGURATION
|
||||
|
||||
Make symlink:
|
||||
cd /path/to/munin/etc/plugins
|
||||
ln -s /path/to/munin/lib/plugins/forks .
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
K.Cima https://github.com/shakemid
|
||||
|
||||
=head1 LICENSE
|
||||
|
||||
GPLv2
|
||||
|
||||
=head1 Magic markers
|
||||
|
||||
#%# family=contrib
|
||||
#%# capabilities=autoconf
|
||||
|
||||
=cut
|
||||
|
||||
# Include plugin.sh
|
||||
. "${MUNIN_LIBDIR:-}/plugins/plugin.sh"
|
||||
|
||||
# Shell options
|
||||
set -o nounset # Like perl use strict;
|
||||
|
||||
# Graph settings
|
||||
global_attr="
|
||||
graph_title Fork and exec rate
|
||||
graph_category processes
|
||||
graph_args --base 1000 --lower-limit 0 --rigid
|
||||
graph_vlabel count per second
|
||||
graph_info Fork and exec rate
|
||||
"
|
||||
# data_attr format: field type draw label
|
||||
# label can contain white-spaces.
|
||||
data_attr="
|
||||
sysfork DERIVE LINE fork
|
||||
sysvfork DERIVE LINE vfork
|
||||
sysexec DERIVE LINE exec
|
||||
"
|
||||
|
||||
# Functions
|
||||
|
||||
autoconf() {
|
||||
if [ -x "$( which kstat )" ]; then
|
||||
echo yes
|
||||
else
|
||||
echo "no (failed to find executable 'kstat')"
|
||||
fi
|
||||
}
|
||||
|
||||
config() {
|
||||
local label_max_length=45
|
||||
|
||||
# print global attributes
|
||||
sed -e 's/^ *//' -e '/^$/d' <<< "${global_attr}"
|
||||
|
||||
# print data source attributes
|
||||
# split line into field,type,draw,label
|
||||
local fields field type draw label
|
||||
fields=
|
||||
while read -r field type draw label
|
||||
do
|
||||
[ -z "$field" ] && continue
|
||||
fields="${fields} ${field}"
|
||||
|
||||
echo "${field}.type ${type}"
|
||||
echo "${field}.draw ${draw}"
|
||||
echo "${field}.label ${label:0:${label_max_length}}"
|
||||
if [ "${type}" = DERIVE ]; then
|
||||
echo "${field}.min 0"
|
||||
fi
|
||||
done <<< "${data_attr}"
|
||||
|
||||
echo graph_order "$fields"
|
||||
}
|
||||
|
||||
getvalue() {
|
||||
local field type draw label
|
||||
while read -r field type draw label
|
||||
do
|
||||
[ -z "$field" ] && continue
|
||||
value=$( kstat -p "cpu::sys:${field}" | awk '{ sum += $2 } END { print sum }' )
|
||||
echo "${field}.value ${value}"
|
||||
done <<< "${data_attr}"
|
||||
}
|
||||
|
||||
# Main
|
||||
case ${1:-} in
|
||||
autoconf)
|
||||
autoconf
|
||||
;;
|
||||
config)
|
||||
config
|
||||
[ "${MUNIN_CAP_DIRTYCONFIG:-}" = "1" ] && getvalue
|
||||
;;
|
||||
*)
|
||||
getvalue
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
Loading…
Add table
Add a link
Reference in a new issue