Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
Check if files are periodically updated on a windows share
Meet The New Nagios Core Services Platform
Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.
Monitoring Made Magically Better
- Nagios Core on Overdrive
- Powerful Monitoring Dashboards
- Time-Saving Configuration Wizards
- Open Source Powered Monitoring On Steroids
- And So Much More!
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
}
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)
bygasp72, November 10, 2012
The error is related to NEWC variable
Try to modify line 64 with this code
[[ $TDIFm -lt $FMXT ]] && CRIT="no" && ((NEWC++))
Try to modify line 64 with this code
[[ $TDIFm -lt $FMXT ]] && CRIT="no" && ((NEWC++))
./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'
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'