HeatWare.net header image
HeatWare.net
TwitterRSSEmail
  • Home
  • Windows
    • Windows 8
    • Windows 7
    • Windows Vista
    • Windows XP
  • Linux/Unix
  • Mac
  • Mobile
    • Android
    • iOS
    • Phones (Help / Resources)
  • Software / Programming
    • Free Software
    • Programming – General
    • PHP
    • Ruby/Rails
    • Quality Assurance (QA)
    • Software – General
    • Software Help
    • Databases
  • Cool Websites
  • Other
    • Deals & Bargains
    • News
    • Video Games
    • Hardware
    • Electronics
  • About

0 comments / January 19, 2016 / sood / Linux/Unix

Simple script to monitor Xen node utilization with email alert

Here is a simple script that utilizes xentop to monitor your Xen server. You can schedule this via cron to run every X minutes to track the load average and if gets too high, it will email you (be sure you change your-emailid to your actual email address)

#!/bin/bash

loadavg=`uptime | awk '{print $10}'`

process=`nproc`

# bash doesn't understand floating point

# so convert the number to an interger

thisloadavg=`echo $loadavg|awk -F \. '{print $1}'`

if [ "$thisloadavg" -ge "$process" ]; then

echo "Busy - Load Average $loadavg ($thisloadavg) "
host=`hostname`
top=`top -bn 1 | head -20`
vmstat=`xentop -b -i 3 | sort -r -nk4 | head -15 | awk '!_[$1]++'`
stat=`netstat -ntuplaee`
echo -e "Top out:\n ${top}\n\nNetstat out:\n${stat}\n\nVMStat Out:\n${vmstat}" | mail -s "Load Alert from ${host}" your-emailid
else

echo "Okay - Load Average $loadavg ($thisloadavg) "
fi

Related Posts

  • Run a script on Linux startup in 2 simple steps
  • Using Linux ‘head’ command to preview a file
  • How to find all installed RPMs in Linux

Linux Xen

0 comments… add one
Cancel reply

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Recent Posts

  • Why You Should Consider Diving Apps
  • How to Buy a Smartphone that Fits Your Budget
  • How to Overcome Frustrating PDF Stress
  • Convert PDF to Word: Easy, Reliable and Quality Conversion
  • PDF to Excel App ­ – A New Way of Handling Tricky Documents

Recent Comments

  • Valarie Walter on Basic Troubleshooting Steps for your Cell Phone
  • John Mists on A Brief History of Android OS
  • syarif on PostgreSQL: How to reload config settings without restarting database
  • Raghu on How to SSH to a server using Ruby – Part I
  • francisco clemente on Basic Troubleshooting Steps for your Cell Phone

Tags

ACSLS Android Bargain Cell Phones Cool Software Cool Websites Databases Deals Ebooks Facebook Free Software G2x Galaxy S5 iOS iPhone Kindle LG Linux Linux/Unix Mac Mobile mysql Office OpenStack OS X PHP Postgres PostgreSQL ruby Samsung Galaxy S6 Shell Smartphones Sun T-Mobile Tips Tips & Tricks Ubuntu Unix Virtualization VMWare Windows Windows 7 Windows 8 Windows Vista Windows XP

Latest Tweet

Follow @HeatwaredotNet

SP
@HeatwaredotNet

  • Why You Should Consider Diving Apps https://t.co/Is41cdUv2I #diving-apps
    about 6 years ago

All Categories

Other Links

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org

Copyright © 2015 — HeatWare