CloudLinux - CloudLinux Blog - Sending regular emails to yourself with LVE usage
Blog

Sending regular emails to yourself with LVE usage

* Script was changed to use order-by instead of by-usage

Lets say you would like to get an email every two weeks containing summary info on customer usage. This is something very simple to script with LVE.

First, make sure you have lve-stats installed:
# yum install lve-stats


Then create a script, lets call it /usr/local/bin/biweekly-lve-usage
#!/bin/bash

PERIOD=14d #number of days in summary reporting, lets do it 7 days, for the simplicity
ENTRIES=10 #number of entries per summary

echo "TOP $ENTRIES users by memory usage"
lveinfo --period=$PERIOD --limit=$ENTRIES --order-by=mem_avg --display-username
echo
echo "TOP $ENTRIES users by memory faults"
lveinfo --period=$PERIOD --limit=$ENTRIES --by-fault=mem --display-username
echo
echo "TOP $ENTRIES users by cpu usage"
lveinfo --period=$PERIOD --limit=$ENTRIES --order-by=cpu_avg --display-username
echo
echo "TOP $ENTRIES users by process entry faults"
lveinfo --period=$PERIOD --limit=$ENTRIES --by-fault=mep --display-username


Once you have the script, just add an cronjob entry that looks like this:
0 5 */14 * * sh /usr/local/bin/biweekly-lve-usage| mailx -s "LVE usage report `hostname` `date`" [email protected]

This will send you report every 14 days
Beta: CloudLinux 6 - kmod-lve-1.1-8 update
CageFS 3.2 Beta 2
 

By accepting you will be accessing a service provided by a third-party external to https://www.cloudlinux.com/

EU e-Privacy Directive

This website uses cookies to ensure you get the best experience using our website and services. If you prefer we don’t use cookies, please disable them in your browser.

You have declined cookies. This decision can be reversed.

You have allowed cookies to be placed on your computer. This decision can be reversed.