Created
November 13, 2013 19:11
-
-
Save abutcher/7454608 to your computer and use it in GitHub Desktop.
If any files are older than one hour grab your knees and cry loudly.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| import os.path | |
| import time | |
| import sys | |
| files = [] | |
| for line in os.popen("ls /var/log/rsyslog_queue/").readlines(): | |
| files.append("/var/log/rsyslog_queue/" + line.strip()) | |
| old_files = [] | |
| for f in files: | |
| if os.path.getmtime(f) < (time.time() - 3600): | |
| old_files.append(f) | |
| if len(old_files) > 0: | |
| print "RSYSLOG_QUEUE CRITICAL: queue files older than one hour %s" % (old_files) | |
| sys.exit(1) | |
| else: | |
| print "RSYSLOG_QUEUE OK" | |
| sys.exit(0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment