{"id":464,"date":"2009-10-23T11:42:48","date_gmt":"2009-10-23T11:42:48","guid":{"rendered":"http:\/\/g33kinfo.com\/info\/index.php\/?p=464"},"modified":"2009-10-23T11:42:48","modified_gmt":"2009-10-23T11:42:48","slug":"load-alert-monitoring","status":"publish","type":"post","link":"https:\/\/g33kinfo.com\/info\/load-alert-monitoring\/","title":{"rendered":"Load Alert Monitoring"},"content":{"rendered":"<p>http:\/\/nixcraft.com\/shell-scripting\/923-cpu-usage-shell-script-monitoring-cpu-usage.html<br \/>\nhttp:\/\/itmission.org\/Main\/Load-alert-bash-script-for-linux-servers<\/p>\n<p>Here is the script if 15 minutes load goes >= 6.0.<\/p>\n<p>Code:<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br \/>\n<code><br \/>\n#!\/bin\/bash<br \/>\n# Set up limit below<br \/>\nNOTIFY=\"6.0\"<br \/>\nFTEXT='load average:'<br \/>\n# 15 min<br \/>\nF15M=\"$(uptime | awk -F \"$FTEXT\" '{ print $2 }' | cut -d, -f3)\"<br \/>\n# compare it with last 15 min load average<br \/>\nRESULT=$(echo \"$F15M > $NOTIFY\" | bc)<br \/>\n# if load >= 6.0 create a file \/tmp\/file.txt<br \/>\nif [ \"$RESULT\" == \"1\" ]; then<br \/>\n        echo 'LOAD ISSUE'>\/tmp\/file.txt<br \/>\nfi<br \/>\n<\/code><\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br \/>\nLoad alert bash script for Linux Servers<br \/>\nAdvanced Server Load Alert Script With Process Status.<br \/>\nFile for the script vi \/root\/loadalert<br \/>\nGet the process status report through e-mail for server load, you can try to add additional info to the code, to get more info through e-mail.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br \/>\n<code><br \/>\n    #!\/bin\/bash<br \/>\n    #Wednesday, December 06 2006<br \/>\n    EMAIL=\"your email 1\"<br \/>\n    EMAIL1=\"your email 2\"<br \/>\n    SUBJECT=\"Alert $(hostname) load average is $L05\"<br \/>\n    TEMPFILE=\"\/tmp\/$(hostname)\"<br \/>\n    echo \"Load average Crossed allowed limit.\" >> $TEMPFILE<br \/>\n    echo \"Hostname: $(hostname)\" >> $TEMPFILE<br \/>\n    echo \"Local Date & Time : $(date)\" >> $TEMPFILE<br \/>\n    echo \"| Uptime status: |\" >> $TEMPFILE<br \/>\n    echo \"-------------------------------------------\" >> $TEMPFILE<br \/>\n    \/usr\/bin\/uptime >> $TEMPFILE<br \/>\n    echo \"-------------------------------------------\" >> $TEMPFILE<br \/>\n    echo \"| Top 20 CPU consuming processes: |\" >> $TEMPFILE<br \/>\n    ps aux | head -1 >> $TEMPFILE<br \/>\n    ps aux --no-headers | sort -rn +2 | head -20 >> $TEMPFILE<br \/>\n    echo \"| Top 10 memory-consuming processes: |\" >> $TEMPFILE<br \/>\n    ps aux --no-headers| sort -rn +3 | head >> $TEMPFILE<br \/>\n    echo \"-------------------------------------------\" >> $TEMPFILE<br \/>\n    echo \"| Memory and Swap status: |\" >> $TEMPFILE<br \/>\n    \/usr\/bin\/free -m >> $TEMPFILE<br \/>\n    echo \"-------------------------------------------\" >> $TEMPFILE<br \/>\n    echo \"| Active network connection: |\" >> $TEMPFILE<br \/>\n    echo \"-------------------------------------------\" >> $TEMPFILE<br \/>\n    \/bin\/netstat -tnup | grep ESTA >> $TEMPFILE<br \/>\n    echo \"-------------------------------------------\" >> $TEMPFILE<br \/>\n    echo \"| Disk Space information: |\" >> $TEMPFILE<br \/>\n    echo \"-------------------------------------------\" >> $TEMPFILE<br \/>\n    \/bin\/df -h >> $TEMPFILE<br \/>\n    echo \"-----------------THE END-------------------\" >> $TEMPFILE<br \/>\n    L05=\"$(uptime|awk '{print $(NF-2)}'|cut -d. -f1)\"<br \/>\n    if test $L05 -gt 5<br \/>\n    then<br \/>\n    mail -s \"$SUBJECT  $L05\" \"$EMAIL\" < $TEMPFILE\n    mail -s \"$SUBJECT  $L05\" \"$EMAIL1\" < $TEMPFILE\n    fi\n    rm -f $TEMPFILE\n<\/code><\/p>\n<p>---------------------------------------------------------------------<\/p>\n<p>    * Give exec permission <\/p>\n<p>        <\/code><code>chmod +x \/root\/loadalert<\/code><\/p>\n<p>    * Now add below in roots cron file \/var\/spool\/cron\/root <\/p>\n<p>        <code>* * * * * \/root\/loadalert >\/dev\/null 2>&1<\/code><\/p>\n<p>    * Restart crond <\/p>\n<p>     <code>\/etc\/init.d\/crond restart<\/code><\/p>\n<p>    * Check log for errors: <\/p>\n<p>    \/var\/log\/cron<code><\/p>\n<p>    * Check Mail log <\/p>\n<p>   <\/code><code>\/var\/log\/exim_mainlog<\/code>  <\/p>\n<p>     if running exim.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>http:\/\/nixcraft.com\/shell-scripting\/923-cpu-usage-shell-script-monitoring-cpu-usage.html http:\/\/itmission.org\/Main\/Load-alert-bash-script-for-linux-servers Here is the script if 15 minutes load goes >= 6.0. Code: &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; #!\/bin\/bash # Set up limit below NOTIFY=&#8221;6.0&#8243; FTEXT=&#8217;load average:&#8217; # 15 min F15M=&#8221;$(uptime | awk -F &#8220;$FTEXT&#8221; &#8216;{ print $2 }&#8217; | cut -d, -f3)&#8221; # compare it with last 15 min load average RESULT=$(echo &#8220;$F15M > $NOTIFY&#8221; | bc)&#8230; <\/p>\n<div class=\"read-more navbutton\"><a href=\"https:\/\/g33kinfo.com\/info\/load-alert-monitoring\/\">Read More<i class=\"fa fa-angle-double-right\"><\/i><\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[],"class_list":["post-464","post","type-post","status-publish","format-standard","hentry","category-info"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.0 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Load Alert Monitoring - Linux Shtuff<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/g33kinfo.com\/info\/load-alert-monitoring\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Load Alert Monitoring - Linux Shtuff\" \/>\n<meta property=\"og:description\" content=\"http:\/\/nixcraft.com\/shell-scripting\/923-cpu-usage-shell-script-monitoring-cpu-usage.html http:\/\/itmission.org\/Main\/Load-alert-bash-script-for-linux-servers Here is the script if 15 minutes load goes &gt;= 6.0. Code: &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; #!\/bin\/bash # Set up limit below NOTIFY=&quot;6.0&quot; FTEXT=&#039;load average:&#039; # 15 min F15M=&quot;$(uptime | awk -F &quot;$FTEXT&quot; &#039;{ print $2 }&#039; | cut -d, -f3)&quot; # compare it with last 15 min load average RESULT=$(echo &quot;$F15M &gt; $NOTIFY&quot; | bc)... Read More\" \/>\n<meta property=\"og:url\" content=\"https:\/\/g33kinfo.com\/info\/load-alert-monitoring\/\" \/>\n<meta property=\"og:site_name\" content=\"Linux Shtuff\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/fb.me\/g33kinf0\" \/>\n<meta property=\"article:author\" content=\"https:\/\/fb.me\/g33kinf0\" \/>\n<meta property=\"article:published_time\" content=\"2009-10-23T11:42:48+00:00\" \/>\n<meta name=\"author\" content=\"g33kadmin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/drsinger1111\" \/>\n<meta name=\"twitter:site\" content=\"@drsinger1111\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/load-alert-monitoring\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/load-alert-monitoring\\\/\"},\"author\":{\"name\":\"g33kadmin\",\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/#\\\/schema\\\/person\\\/c022e4c40b13ea1b678e6f020756f547\"},\"headline\":\"Load Alert Monitoring\",\"datePublished\":\"2009-10-23T11:42:48+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/load-alert-monitoring\\\/\"},\"wordCount\":101,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/#\\\/schema\\\/person\\\/c022e4c40b13ea1b678e6f020756f547\"},\"articleSection\":[\"General Info\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/g33kinfo.com\\\/info\\\/load-alert-monitoring\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/load-alert-monitoring\\\/\",\"url\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/load-alert-monitoring\\\/\",\"name\":\"Load Alert Monitoring - Linux Shtuff\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/#website\"},\"datePublished\":\"2009-10-23T11:42:48+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/load-alert-monitoring\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/g33kinfo.com\\\/info\\\/load-alert-monitoring\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/load-alert-monitoring\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Load Alert Monitoring\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/#website\",\"url\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/\",\"name\":\"Linux Shtuff\",\"description\":\"Because I have CRS Syndrome...\",\"publisher\":{\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/#\\\/schema\\\/person\\\/c022e4c40b13ea1b678e6f020756f547\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/#\\\/schema\\\/person\\\/c022e4c40b13ea1b678e6f020756f547\",\"name\":\"g33kadmin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/minion-researchA.gif\",\"url\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/minion-researchA.gif\",\"contentUrl\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/minion-researchA.gif\",\"width\":512,\"height\":512,\"caption\":\"g33kadmin\"},\"logo\":{\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/minion-researchA.gif\"},\"description\":\"I am a g33k, Linux blogger, developer, student and Tech Writer for Liquidweb.com\\\/kb. My passion for all things tech drives my hunt for all the coolz. I often need a vacation after I get back from vacation....\",\"sameAs\":[\"https:\\\/\\\/thelinuxreport.com\",\"https:\\\/\\\/fb.me\\\/g33kinf0\",\"https:\\\/\\\/x.com\\\/https:\\\/\\\/twitter.com\\\/drsinger1111\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Load Alert Monitoring - Linux Shtuff","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/g33kinfo.com\/info\/load-alert-monitoring\/","og_locale":"en_US","og_type":"article","og_title":"Load Alert Monitoring - Linux Shtuff","og_description":"http:\/\/nixcraft.com\/shell-scripting\/923-cpu-usage-shell-script-monitoring-cpu-usage.html http:\/\/itmission.org\/Main\/Load-alert-bash-script-for-linux-servers Here is the script if 15 minutes load goes >= 6.0. Code: &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; #!\/bin\/bash # Set up limit below NOTIFY=\"6.0\" FTEXT='load average:' # 15 min F15M=\"$(uptime | awk -F \"$FTEXT\" '{ print $2 }' | cut -d, -f3)\" # compare it with last 15 min load average RESULT=$(echo \"$F15M > $NOTIFY\" | bc)... Read More","og_url":"https:\/\/g33kinfo.com\/info\/load-alert-monitoring\/","og_site_name":"Linux Shtuff","article_publisher":"https:\/\/fb.me\/g33kinf0","article_author":"https:\/\/fb.me\/g33kinf0","article_published_time":"2009-10-23T11:42:48+00:00","author":"g33kadmin","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/drsinger1111","twitter_site":"@drsinger1111","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/g33kinfo.com\/info\/load-alert-monitoring\/#article","isPartOf":{"@id":"https:\/\/g33kinfo.com\/info\/load-alert-monitoring\/"},"author":{"name":"g33kadmin","@id":"https:\/\/g33kinfo.com\/info\/#\/schema\/person\/c022e4c40b13ea1b678e6f020756f547"},"headline":"Load Alert Monitoring","datePublished":"2009-10-23T11:42:48+00:00","mainEntityOfPage":{"@id":"https:\/\/g33kinfo.com\/info\/load-alert-monitoring\/"},"wordCount":101,"commentCount":0,"publisher":{"@id":"https:\/\/g33kinfo.com\/info\/#\/schema\/person\/c022e4c40b13ea1b678e6f020756f547"},"articleSection":["General Info"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/g33kinfo.com\/info\/load-alert-monitoring\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/g33kinfo.com\/info\/load-alert-monitoring\/","url":"https:\/\/g33kinfo.com\/info\/load-alert-monitoring\/","name":"Load Alert Monitoring - Linux Shtuff","isPartOf":{"@id":"https:\/\/g33kinfo.com\/info\/#website"},"datePublished":"2009-10-23T11:42:48+00:00","breadcrumb":{"@id":"https:\/\/g33kinfo.com\/info\/load-alert-monitoring\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/g33kinfo.com\/info\/load-alert-monitoring\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/g33kinfo.com\/info\/load-alert-monitoring\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/g33kinfo.com\/info\/"},{"@type":"ListItem","position":2,"name":"Load Alert Monitoring"}]},{"@type":"WebSite","@id":"https:\/\/g33kinfo.com\/info\/#website","url":"https:\/\/g33kinfo.com\/info\/","name":"Linux Shtuff","description":"Because I have CRS Syndrome...","publisher":{"@id":"https:\/\/g33kinfo.com\/info\/#\/schema\/person\/c022e4c40b13ea1b678e6f020756f547"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/g33kinfo.com\/info\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/g33kinfo.com\/info\/#\/schema\/person\/c022e4c40b13ea1b678e6f020756f547","name":"g33kadmin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/g33kinfo.com\/info\/wp-content\/uploads\/2022\/07\/minion-researchA.gif","url":"https:\/\/g33kinfo.com\/info\/wp-content\/uploads\/2022\/07\/minion-researchA.gif","contentUrl":"https:\/\/g33kinfo.com\/info\/wp-content\/uploads\/2022\/07\/minion-researchA.gif","width":512,"height":512,"caption":"g33kadmin"},"logo":{"@id":"https:\/\/g33kinfo.com\/info\/wp-content\/uploads\/2022\/07\/minion-researchA.gif"},"description":"I am a g33k, Linux blogger, developer, student and Tech Writer for Liquidweb.com\/kb. My passion for all things tech drives my hunt for all the coolz. I often need a vacation after I get back from vacation....","sameAs":["https:\/\/thelinuxreport.com","https:\/\/fb.me\/g33kinf0","https:\/\/x.com\/https:\/\/twitter.com\/drsinger1111"]}]}},"_links":{"self":[{"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/posts\/464","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/comments?post=464"}],"version-history":[{"count":0,"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/posts\/464\/revisions"}],"wp:attachment":[{"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/media?parent=464"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/categories?post=464"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/tags?post=464"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}