#!/bin/bash # # Observium Zimbra statistics script # (c) 2013, Tom Laermans # # Tested on Zimbra 8.0.1 Enterprise if [ -d /opt/zimbra/zmstat ]; then # CSV updated every 30 seconds with current gauges for FILENAME in threads fd mtaqueue proc do echo "<<>>" head -n1 /opt/zimbra/zmstat/$FILENAME.csv tail -n1 /opt/zimbra/zmstat/$FILENAME.csv done # CSV updated every 30 seconds with reset, we need data for the last 5 min. for FILENAME in mailboxd convertd do echo "<<>>" head -n1 /opt/zimbra/zmstat/$FILENAME.csv tail -n10 /opt/zimbra/zmstat/$FILENAME.csv|grep -e "../../...." # The grep above avoids bringing along the csv header again before 00:05 done # CSV updated with one line per command, need all from the same timestamp for FILENAME in soap sync pop3 imap ldap do echo "<<>>" head -n1 /opt/zimbra/zmstat/$FILENAME.csv DATE=$(tail -n1 /opt/zimbra/zmstat/$FILENAME.csv|cut -d, -f1) grep "^$DATE" /opt/zimbra/zmstat/$FILENAME.csv done fi