Код: Выделить всё
SAMBA CRITICAL 10-01-2009 21:33:37 0d 22h 51m 49s 4/4 (Return code of 127 is out of bounds - plugin may be missing)
Код: Выделить всё
# 'check_smb' command defination
define command{
command_name check_smb
command_line $USER1$/check_smb -H $HOSTADDRESS$
}
Код: Выделить всё
#SMB Definition BDC
define service{
use generic-service
host_name bdc.c-es.ru
service_description SAMBA
is_volatile 0
check_period 24x7
max_check_attempts 4
normal_check_interval 1
retry_check_interval 1
contact_groups domain-admins
notification_interval 120
notification_period 24x7
notification_options c,r
check_command check_smb
}
Код: Выделить всё
#!/bin/bash
#
# Program : check_smb ls -l
total 1612
-r-xr-xr-x 1 nagios wheel 83096 Sep 29 17:27 check_apt
-r-xr-xr-x 1 nagios wheel 2285 Sep 29 17:27 check_breeze
-r-xr-xr-x 1 nagios wheel 30128 Sep 29 17:27 check_by_ssh
lrwxr-xr-x 1 root wheel 9 Sep 29 17:27 check_clamd -> check_tcp
-r-xr-xr-x 1 nagios wheel 18692 Sep 29 17:27 check_cluster
-r-sr-xr-x 1 nagios wheel 30252 Sep 29 17:27 check_dhcp
-r-xr-xr-x 1 nagios wheel 27120 Sep 29 17:27 check_dig
-r-xr-xr-x 1 nagios wheel 96772 Sep 29 17:27 check_disk
-r-xr-xr-x 1 nagios wheel 8168 Sep 29 17:27 check_disk_smb
-r-xr-xr-x 1 nagios wheel 30256 Sep 29 17:27 check_dns
-r-xr-xr-x 1 nagios wheel 11860 Sep 29 17:27 check_dummy
-r-xr-xr-x 1 nagios wheel 3148 Sep 29 17:27 check_file_age
-r-xr-xr-x 1 nagios wheel 6400 Sep 29 17:27 check_flexlm
-r-xr-xr-x 1 nagios wheel 27888 Sep 29 17:27 check_fping
lrwxr-xr-x 1 root wheel 9 Sep 29 17:27 check_ftp -> check_tcp
-r-xr-xr-x 1 nagios wheel 27056 Sep 29 17:27 check_hpjd
-r-xr-xr-x 1 nagios wheel 130180 Sep 29 17:27 check_http
-r-sr-xr-x 1 nagios wheel 35200 Sep 29 17:27 check_icmp
-r-xr-xr-x 1 nagios wheel 15315 Sep 29 17:27 check_ifoperstatus
-r-xr-xr-x 1 nagios wheel 12858 Sep 29 17:27 check_ifstatus
lrwxr-xr-x 1 root wheel 9 Sep 29 17:27 check_imap -> check_tcp
-r-xr-xr-x 1 nagios wheel 7453 Sep 29 17:27 check_ircd
lrwxr-xr-x 1 root wheel 9 Sep 29 17:27 check_jabber -> check_tcp
-r-xr-xr-x 1 nagios wheel 25740 Sep 29 17:27 check_ldap
lrwxr-xr-x 1 root wheel 10 Sep 29 17:27 check_ldaps -> check_ldap
-r-xr-xr-x 1 nagios wheel 22860 Sep 29 17:27 check_load
-r-xr-xr-x 1 nagios wheel 6082 Sep 29 17:27 check_log
-r-xr-xr-x 1 nagios wheel 20372 Sep 29 17:27 check_mailq
-r-xr-xr-x 1 nagios wheel 22852 Sep 29 17:27 check_mrtg
-r-xr-xr-x 1 nagios wheel 21156 Sep 29 17:27 check_mrtgtraf
-r-xr-xr-x 1 nagios wheel 25740 Sep 29 17:27 check_mysql
-r-xr-xr-x 1 nagios wheel 24012 Sep 29 17:27 check_mysql_query
-r-xr-xr-x 1 nagios wheel 23020 Sep 29 17:27 check_nagios
lrwxr-xr-x 1 root wheel 9 Sep 29 17:27 check_nntp -> check_tcp
lrwxr-xr-x 1 root wheel 9 Sep 29 17:27 check_nntps -> check_tcp
-r-xr-xr-x 1 nagios wheel 32108 Sep 29 17:27 check_nt
-r-xr-xr-x 1 nagios wheel 31404 Sep 29 17:27 check_ntp
-r-xr-xr-x 1 nagios wheel 30156 Sep 29 17:27 check_ntp_peer
-r-xr-xr-x 1 nagios wheel 27436 Sep 29 17:27 check_ntp_time
-r-xr-xr-x 1 nagios wheel 44332 Sep 29 17:27 check_nwstat
-r-xr-xr-x 1 nagios wheel 8366 Sep 29 17:27 check_oracle
-r-xr-xr-x 1 nagios wheel 26092 Sep 29 17:27 check_overcr
-r-xr-xr-x 1 nagios wheel 32848 Sep 29 17:27 check_ping
lrwxr-xr-x 1 root wheel 9 Sep 29 17:27 check_pop -> check_tcp
-r-xr-xr-x 1 nagios wheel 90804 Sep 29 17:27 check_procs
-r-xr-xr-x 1 nagios wheel 24908 Sep 29 17:27 check_real
-r-xr-xr-x 1 nagios wheel 9712 Sep 29 17:27 check_rpc
-r-xr-xr-x 1 nagios wheel 1176 Sep 29 17:27 check_sensors
lrwxr-xr-x 1 root wheel 9 Sep 29 17:27 check_simap -> check_tcp
-rwxr-xr-x 1 nagios wheel 2633 Oct 1 10:02 check_smb.sh
-r-xr-xr-x 1 nagios wheel 100388 Sep 29 17:27 check_smtp
-r-xr-xr-x 1 nagios wheel 126104 Sep 29 17:27 check_snmp
lrwxr-xr-x 1 root wheel 9 Sep 29 17:27 check_spop -> check_tcp
-r-xr-xr-x 1 nagios wheel 22924 Sep 29 17:27 check_ssh
lrwxr-xr-x 1 root wheel 9 Sep 29 17:27 check_ssmtp -> check_tcp
-r-xr-xr-x 1 nagios wheel 24780 Sep 29 17:27 check_swap
-r-xr-xr-x 1 nagios wheel 32728 Sep 29 17:27 check_tcp
-r-xr-xr-x 1 nagios wheel 24012 Sep 29 17:27 check_time
lrwxr-xr-x 1 root wheel 9 Sep 29 17:27 check_udp -> check_tcp
-r-xr-xr-x 1 nagios wheel 29100 Sep 29 17:27 check_ups
-r-xr-xr-x 1 nagios wheel 21484 Sep 29 17:27 check_users
-r-xr-xr-x 1 nagios wheel 3024 Sep 29 17:27 check_wave
-r-xr-xr-x 1 nagios wheel 23212 Sep 29 17:27 negate
-r-xr-xr-x 1 nagios wheel 21740 Sep 29 17:27 urlize
-r-xr-xr-x 1 nagios wheel 2075 Sep 29 17:27 utils.pm
-r-xr-xr-x 1 nagios wheel 880 Sep 29 17:27 utils.sh
# :
# Author : Cal Evans <cal@calevans.com>
# :
# Purpose : Nagios plugin to return the number of users logged into a smb
# : server and the number of files open.
# :
# Parameters : --help
# : --version
# :
# Returns : Standard Nagios status_* codes as defined in utils.sh
# :
# Notes :
#============:==============================================================
# 1.0 : 06/27/2002
# : Initial coding
# :
# 1.1 : 06/28/2002
# : Re-wrote the user counter to match the file-lock counter.
# :
#
# Shamelessly stolen from other Nagios plugins.
#
PROGNAME=`basename $0`
PROGPATH=`echo $0 | /bin/sed -e 's,[\\/][^\\/][^\\/]*$,,'`
REVISION=`echo '$Revision: 71 $' | sed -e 's/[^0-9.]//g'`
. $PROGPATH/utils.sh
print_usage() {
echo "Usage: $PROGNAME --help"
echo "Usage: $PROGNAME --version"
}
print_help() {
print_revision $PROGNAME $REVISION
echo ""
print_usage
echo ""
echo "Samba status check."
echo ""
support
}
# No command line arguments are required for this script. We accept only 2,
# --help and --version. If more than 1 is passed in then we have an error
# condition.
if [ $# -gt 1 ]; then
print_usage
exit $STATE_UNKNOWN
fi
#
# If we have arguments, process them.
#
exitstatus=$STATE_WARNING #default
while test -n "$1"; do
case "$1" in
--help)
print_help
exit $STATE_OK
;;
-h)
print_help
exit $STATE_OK
;;
--version)
print_revision $PROGNAME $REVISION
exit $STATE_OK
;;
-V)
print_revision $PROGNAME $REVISION
exit $STATE_OK
;;
*)
echo "Unknown argument: $1"
print_usage
exit $STATE_UNKNOWN
;;
esac
shift
done
#
# No arguments. Let's kick this pig.
#
total_users=$(smbstatus -b | grep "^[0-9]" | wc -l)
#
# Ok, now let's grab a count of the files.
#
total_files=$(smbstatus | grep "^[0-9]" | wc -l)
#
# now for the dismount.
#
echo "Total Users:$total_users Total Files:$total_files"
#
# let Nagios know that everything is ok.
#
exit $STATE_OK
Код: Выделить всё
./check_smb -H localhost
./check_smb: Command not found.
%./check_smb.sh -h localhost
./check_smb.sh: Command not found.
Код: Выделить всё
ls -l
total 1612
-r-xr-xr-x 1 nagios wheel 83096 Sep 29 17:27 check_apt
-r-xr-xr-x 1 nagios wheel 2285 Sep 29 17:27 check_breeze
-r-xr-xr-x 1 nagios wheel 30128 Sep 29 17:27 check_by_ssh
lrwxr-xr-x 1 root wheel 9 Sep 29 17:27 check_clamd -> check_tcp
-r-xr-xr-x 1 nagios wheel 18692 Sep 29 17:27 check_cluster
-r-sr-xr-x 1 nagios wheel 30252 Sep 29 17:27 check_dhcp
-r-xr-xr-x 1 nagios wheel 27120 Sep 29 17:27 check_dig
-r-xr-xr-x 1 nagios wheel 96772 Sep 29 17:27 check_disk
-r-xr-xr-x 1 nagios wheel 8168 Sep 29 17:27 check_disk_smb
-r-xr-xr-x 1 nagios wheel 30256 Sep 29 17:27 check_dns
-r-xr-xr-x 1 nagios wheel 11860 Sep 29 17:27 check_dummy
-r-xr-xr-x 1 nagios wheel 3148 Sep 29 17:27 check_file_age
-r-xr-xr-x 1 nagios wheel 6400 Sep 29 17:27 check_flexlm
-r-xr-xr-x 1 nagios wheel 27888 Sep 29 17:27 check_fping
lrwxr-xr-x 1 root wheel 9 Sep 29 17:27 check_ftp -> check_tcp
-r-xr-xr-x 1 nagios wheel 27056 Sep 29 17:27 check_hpjd
-r-xr-xr-x 1 nagios wheel 130180 Sep 29 17:27 check_http
-r-sr-xr-x 1 nagios wheel 35200 Sep 29 17:27 check_icmp
-r-xr-xr-x 1 nagios wheel 15315 Sep 29 17:27 check_ifoperstatus
-r-xr-xr-x 1 nagios wheel 12858 Sep 29 17:27 check_ifstatus
lrwxr-xr-x 1 root wheel 9 Sep 29 17:27 check_imap -> check_tcp
-r-xr-xr-x 1 nagios wheel 7453 Sep 29 17:27 check_ircd
lrwxr-xr-x 1 root wheel 9 Sep 29 17:27 check_jabber -> check_tcp
-r-xr-xr-x 1 nagios wheel 25740 Sep 29 17:27 check_ldap
lrwxr-xr-x 1 root wheel 10 Sep 29 17:27 check_ldaps -> check_ldap
-r-xr-xr-x 1 nagios wheel 22860 Sep 29 17:27 check_load
-r-xr-xr-x 1 nagios wheel 6082 Sep 29 17:27 check_log
-r-xr-xr-x 1 nagios wheel 20372 Sep 29 17:27 check_mailq
-r-xr-xr-x 1 nagios wheel 22852 Sep 29 17:27 check_mrtg
-r-xr-xr-x 1 nagios wheel 21156 Sep 29 17:27 check_mrtgtraf
-r-xr-xr-x 1 nagios wheel 25740 Sep 29 17:27 check_mysql
-r-xr-xr-x 1 nagios wheel 24012 Sep 29 17:27 check_mysql_query
-r-xr-xr-x 1 nagios wheel 23020 Sep 29 17:27 check_nagios
lrwxr-xr-x 1 root wheel 9 Sep 29 17:27 check_nntp -> check_tcp
lrwxr-xr-x 1 root wheel 9 Sep 29 17:27 check_nntps -> check_tcp
-r-xr-xr-x 1 nagios wheel 32108 Sep 29 17:27 check_nt
-r-xr-xr-x 1 nagios wheel 31404 Sep 29 17:27 check_ntp
-r-xr-xr-x 1 nagios wheel 30156 Sep 29 17:27 check_ntp_peer
-r-xr-xr-x 1 nagios wheel 27436 Sep 29 17:27 check_ntp_time
-r-xr-xr-x 1 nagios wheel 44332 Sep 29 17:27 check_nwstat
-r-xr-xr-x 1 nagios wheel 8366 Sep 29 17:27 check_oracle
-r-xr-xr-x 1 nagios wheel 26092 Sep 29 17:27 check_overcr
-r-xr-xr-x 1 nagios wheel 32848 Sep 29 17:27 check_ping
lrwxr-xr-x 1 root wheel 9 Sep 29 17:27 check_pop -> check_tcp
-r-xr-xr-x 1 nagios wheel 90804 Sep 29 17:27 check_procs
-r-xr-xr-x 1 nagios wheel 24908 Sep 29 17:27 check_real
-r-xr-xr-x 1 nagios wheel 9712 Sep 29 17:27 check_rpc
-r-xr-xr-x 1 nagios wheel 1176 Sep 29 17:27 check_sensors
lrwxr-xr-x 1 root wheel 9 Sep 29 17:27 check_simap -> check_tcp
-rwxr-xr-x 1 nagios wheel 2633 Oct 1 10:02 check_smb.sh
-r-xr-xr-x 1 nagios wheel 100388 Sep 29 17:27 check_smtp
-r-xr-xr-x 1 nagios wheel 126104 Sep 29 17:27 check_snmp
lrwxr-xr-x 1 root wheel 9 Sep 29 17:27 check_spop -> check_tcp
-r-xr-xr-x 1 nagios wheel 22924 Sep 29 17:27 check_ssh
lrwxr-xr-x 1 root wheel 9 Sep 29 17:27 check_ssmtp -> check_tcp
-r-xr-xr-x 1 nagios wheel 24780 Sep 29 17:27 check_swap
-r-xr-xr-x 1 nagios wheel 32728 Sep 29 17:27 check_tcp
-r-xr-xr-x 1 nagios wheel 24012 Sep 29 17:27 check_time
lrwxr-xr-x 1 root wheel 9 Sep 29 17:27 check_udp -> check_tcp
-r-xr-xr-x 1 nagios wheel 29100 Sep 29 17:27 check_ups
-r-xr-xr-x 1 nagios wheel 21484 Sep 29 17:27 check_users
-r-xr-xr-x 1 nagios wheel 3024 Sep 29 17:27 check_wave
-r-xr-xr-x 1 nagios wheel 23212 Sep 29 17:27 negate
-r-xr-xr-x 1 nagios wheel 21740 Sep 29 17:27 urlize
-r-xr-xr-x 1 nagios wheel 2075 Sep 29 17:27 utils.pm
-r-xr-xr-x 1 nagios wheel 880 Sep 29 17:27 utils.sh
