/usr/share/munin/plugins/samba is in munin-plugins-extra 2.0.19-3.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | #!/bin/sh
# -*- sh -*-
: << =cut
=head1 NAME
samba - Plugin to monitor number of files held open by the CIFS clients
=head1 CONFIGURATION
This plugin uses the following configuration variables
[samba]
env.smbstatus - Path to "smbstatus" executable
env.ignoreipcshare - Set this variable to ignore IPC$ when counting shares.
=head1 AUTHOR
Unknown author
=head1 LICENSE
GPLv2
=head1 MAGIC MARKERS
#%# family=contrib
#%# capabilities=autoconf
=cut
SMBSTATUS=${smbstatus:-`which smbstatus`}
SMBSTATUS=${SMBSTATUS:-/usr/bin/smbstatus}
if [ "$1" = "autoconf" ]; then
if [ -x $SMBSTATUS ]; then
echo yes
exit 0
else
echo no '(smbstatus not found)'
exit 0
fi
fi
if [ "$1" = "config" ]; then
echo 'graph_title Samba status'
echo 'graph_args -l 0'
echo 'graph_vlabel number'
echo 'graph_category samba'
echo 'proc.label processes'
echo 'lock.label locked files'
echo 'share.label Open shares'
# Bug pointed out by kozik: there is no max field.
# echo 'max.warning 900'
# echo 'max.critical 960'
exit 0
fi
$SMBSTATUS -p 2>/dev/null | awk 'BEGIN {lines=0} $1 ~ /^[0-9]+/ {lines++} END {print "proc.value " lines}'
$SMBSTATUS -L 2>/dev/null | awk 'BEGIN {lines=0} $1 ~ /^[0-9]+/ {lines++} END {print "lock.value " lines}'
if [ -n "$ignoreipcshare" ]; then
IGNORE='$1=="IPC$" {next}'
fi
$SMBSTATUS -S 2>/dev/null | awk '
BEGIN {lines=0;state=0}
$1=="Service"&&state==0 {state=1;next}
/^--*$/&&state==1 {state=2;next}
state<2 {next}
/^$/ {next}
'"$IGNORE"'
{lines++}
END {print "share.value " lines}'
|