Skip to content

Instantly share code, notes, and snippets.

@abutcher
Created November 13, 2013 19:11
Show Gist options
  • Select an option

  • Save abutcher/7454608 to your computer and use it in GitHub Desktop.

Select an option

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.
#!/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