Skip to content

Instantly share code, notes, and snippets.

@reyjrar
Created November 19, 2011 01:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save reyjrar/1378303 to your computer and use it in GitHub Desktop.
Save reyjrar/1378303 to your computer and use it in GitHub Desktop.
log the number of distinct hosts communicating with syslog in the past 60 minutes
#!/bin/sh
# Assumes /var/log/remote/%HOSTNAME/ configuration for central logger
#
# collect data
time=`date +%s`;
distinct=`find /var/log/remote -mmin -60 | cut -d/ -f5| sort -u |wc -l`
# send it!
echo "syslog.distinct_hosts $distinct $time" | nc graphite 2003
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment