File System

Check if files are periodically updated on a windows share

Description:

This plugin is a bash script which will check a windows share using the smbclient command. It will alert critical if the files matching a pattern are older then a specified amount of time or are not found. It can also warn if the files are not bigger then the specified limit.

Current Version

Last Release Date

June 14, 2012

Compatible With

  • Nagios 3.x

Owner

License

GPL


Project Files
Project Notes
Command Usage: share-file-check.sh -u USERNAME -p PASSWORD -W WORKGROUP -s SMBSHARE -f FILEPATH -c FILEMAXTIME -w FILESIZEMIN [-d] Example: $ ./share-file-check.sh -u nagios -p $PASS -W domain.com -s //fileserver/share -f '/backups/*' -c 900 -w 80000000 -d daily-backup-2012_06_07.zip - 81847979 bytes, 7537 min daily-backup-2012_06_08.zip - 81889345 bytes, 7537 min daily-backup-2012_06_09.zip - 81895321 bytes, 6726 min daily-backup-2012_06_10.zip - 81895385 bytes, 5286 min daily-backup-2012_06_11.zip - 81895501 bytes, 3846 min daily-backup-2012_06_12.zip - 81927794 bytes, 2406 min daily-backup-2012_06_13.zip - 81967408 bytes, 966 min No files found newer than 900 minutes! Nagios config: define command{ command_name check_backup command_line $USER1$/share-file-check.sh -u $ARG1$ -p $ARG2$ -W $ARG3$ -s $ARG4$ -f $ARG5$ -c $ARG6$ -w $ARG7$ } define service { service_description backup-check use generic-service host_name someserver notification_options w,c,r contact_groups just_mail #Ensure newer files are found then 3d (4320m) and are bigger then 47mb (50000000 bytes). check_command check_backup!nagios!SeCrEt!domain.com!//fileserver/share!/backups/*!4320!50000000 }
Reviews (2) Add a Review
bash error on NEWC++
by gasp72, November 30, 2012

The error is related to NEWC variable Try to modify line 64 with this code [[ $TDIFm -lt $FMXT ]] && CRIT="no" && ((NEWC++))



very interersting plugin but...
by Benj, September 30, 2012

./check_file.sh: line 64: 0: command not found when the result of the script should give me the ok result (files are newer and bigger than the arguments)... What's the problem with this case ? [[ $TDIFm -lt $FMXT ]] && $((NEWC++)) && CRIT='no' [[ $SIZE -lt $FSZM ]] && WARN='yes'



Add a Review

You must be logged in to submit a review.

Thank you for your review!

Your review has been submitted and is pending approval.

Recommend

To:


From:


Thank you for your recommendation!

Your recommendation has been sent.

Project Stats
Rating
3.5 (4)
Favorites
0
Views
69,889