Goal here is to monitor disk space usage on my parents' iMac, push it to Kinesis, and alert if it hits a certain threshold.
Set up a Kinesis stream called osquery-firehose
.
- Download the config.
- Run the command in
osquery.sh
. - This will log to
/var/log/osquery/osqueryd.results.log
To create a LaunchDaemon which will run on startup, do the following:
sudo cp path/to/your.conf /var/osquery/osquery.conf
sudo cp com.facebook.osqueryd.plist /Library/LaunchDaemons/
sudo launchctl load /Library/LaunchDaemons/com.facebook.osqueryd.plist
Select the most recent values from Athena:
WITH summary AS ( SELECT p.hostidentifier, p.unixtime, p.calendartime, p.columns.gigs_free as gigs_free, ROW_NUMBER() OVER(PARTITION BY p.hostidentifier ORDER BY p.unixtime DESC) AS rk FROM osquery_merrick p) SELECT s.hostidentifier, s.calendartime, s.gigs_free FROM summary s WHERE s.rk = 1
- For now, I'm just writing my own custom alerting, but this looks promising: https://github.com/airbnb/streamalert.