forks - Munin plugin to monitor Solaris fork and exec rate
Configuration
Make symlink:
cd /path/to/munin/etc/plugins
ln -s /path/to/munin/lib/plugins/forks .
Author
K.Cima https://github.com/shakemid
License
GPLv2
Magic Markers
#%# family=contrib
#%# capabilities=autoconf
#!/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 which kstat >/dev/null ; then
echo yes
else
echo "no (failed to find executable 'kstat')"fi}
config(){
local label_max_length=45# print global attributes
echo "$global_attr" | sed -e 's/^ *//' -e '/^$/d'# print data source attributes# split line into field,type,draw,label
local field type draw label
echo "$data_attr" | while read -r field type draw label
do[ -z "$field"]&&continue
echo "${field}.type ${type}"
echo "${field}.draw ${draw}"
echo "${field}.label ${label:0:${label_max_length}}"if["${type}"= DERIVE ]; then
echo "${field}.min 0"fidone}
fetch(){
local field type draw label
echo "$data_attr" | 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}# Maincase${1:-} in
autoconf)
autoconf
;;
config)
config
if["${MUNIN_CAP_DIRTYCONFIG:-0}"="1"]; then fetch; fi
;;
*)
fetch
;;
esac
exit 0