Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check_files.pl issue with directory listings (remote file system) #47

Open
nebj00la opened this issue Jan 10, 2014 · 2 comments
Open

check_files.pl issue with directory listings (remote file system) #47

nebj00la opened this issue Jan 10, 2014 · 2 comments

Comments

@nebj00la
Copy link

I've mounted a cifs share, and sometimes the times do not show up in the output of "ls -l" or "ls -la", etc. I've found the times always show up with the following usage:

ls -l --time-style=+"%M %D:%H:%M"
ls --full-time

There are other methods that show the time, as well. The main problem is that I can't find a way for the script to measure "file ages" properly due to the issue in the mounted directory.

@nebj00la
Copy link
Author

Examples:

[root@sa-atms-sr1-sysmon cctv_images]# ls -l
total 5328
-rwxrwSrwx 1 root root 79953 Jan 10 02:07 foo.jpg
-rwxrwSrwx 1 root root 40455 Jan 10 2014 [GP][CCTV 101].jpg
-rwxrwSrwx 1 root root 50507 Jan 10 2014 [GP]
[CCTV 102].jpg

[root@sa-atms-sr1-sysmon cctv_images]# ls --full-time
total 5268
-rwxrwSrwx 1 root root 79953 2014-01-10 02:07:04.966800000 +0200 foo.jpg
-rwxrwSrwx 1 root root 40455 2014-01-10 02:21:15.198000000 +0200 [GP][CCTV 101].jpg
-rwxrwSrwx 1 root root 44972 2014-01-10 02:21:19.300800000 +0200 [GP]
[CCTV 102].jpg

[root@sa-atms-sr1-sysmon cctv_images]# ls -l --time-style=+"%M %D:%H:%M"
total 5268
-rwxrwSrwx 1 root root 79953 07 01/10/14:02:07 foo.jpg
-rwxrwSrwx 1 root root 40455 21 01/10/14:02:21 [GP][CCTV 101].jpg
-rwxrwSrwx 1 root root 44972 21 01/10/14:02:21 [GP]
[CCTV 102].jpg

@nebj00la
Copy link
Author

Script results using those examples:

[root@sa-atms-sr1-sysmon cctv_images]# /usr/lib/nagios/plugins/./check_files.pl -L Files -F '' -w <30 -c <1 -C 'ls -l /mnt/cctv_images/.jpg' --age=300,600 -f
Files CRITICAL - /mnt/cctv_images/[GP]_[CCTV is 8614 (more than 600) seconds old - 102 * files found | '*'=102;30:;1: age_oldest=8614s;300;600 age_newest=8614s

[root@sa-atms-sr1-sysmon cctv_images]# /usr/lib/nagios/plugins/./check_files.pl -L Files -F '' -w <30 -c <1 -C 'ls --full-time /mnt/cctv_images/.jpg' --age=300,600 -f
Files CRITICAL - /mnt/cctv_images/[GP]_[Pilot is -29.9876000881195 (less than 0) seconds old - 102 * files found | '*'=102;30:;1: age_oldest=-29.9876000881195s;300;600 age_newest=-56.8352000713348s

[root@sa-atms-sr1-sysmon cctv_images]# /usr/lib/nagios/plugins/./check_files.pl -L Files -F '' -w <30 -c <1 -C 'ls -l --time-style=+"%M %D:%H:%M" /mnt/cctv_images/.jpg' --age=300,600 -f
Files OK - 102 * files found | '*'=102;30:;1: age_oldest=0s;300;600 age_newest=0s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant