{"id":131,"date":"2016-06-03T18:41:50","date_gmt":"2016-06-03T18:41:50","guid":{"rendered":"http:\/\/symbioticindia.in\/docu\/?p=131"},"modified":"2016-06-03T18:42:05","modified_gmt":"2016-06-03T18:42:05","slug":"email-alert-on-disk-space-outage-in-linuxvicidialgoautodial-server","status":"publish","type":"post","link":"http:\/\/symbioticindia.in\/docu\/2016\/06\/03\/email-alert-on-disk-space-outage-in-linuxvicidialgoautodial-server\/","title":{"rendered":"Email alert on disk space outage in\u00a0linux\/vicidial\/goautodial server"},"content":{"rendered":"<h1><\/h1>\n<p><em>Email alert when hard disk is full in linux<\/em><\/p>\n<p>&nbsp;<\/p>\n<p><em>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0Most of times i will be facing mysql database crash error due to my hard disk out of space , Because of huge call Recordings in vicidial or goautodial server.<\/em><\/p>\n<p><em>so i decided to have a alert via email when my harddisk space reaches 90% .<\/em><\/p>\n<p><em>Below is the script i used to get email alert when my hard disk reaches 90% full<\/em><\/p>\n<p><em>thanks to :\u00a0http:\/\/www.cyberciti.biz\/<\/em><\/p>\n<p>*******************************<\/p>\n<p><em>Step 1: Create a bash script file<\/em><\/p>\n<p>*******************************<\/p>\n<p>vi \/usr\/share\/diskspacealert.sh<\/p>\n<p>*******************************<\/p>\n<p><em>Step 2 : paste the below script<\/em><\/p>\n<p>*******************************<\/p>\n<p>#!\/bin\/sh<\/p>\n<p># refered http:\/\/www.cyberciti.biz\/tips\/shell-script-to-watch-the-disk-space.html<\/p>\n<p># enter your mailed below for email alert<\/p>\n<p>ADMIN=&#8221;admin123@gmail.com&#8221;<\/p>\n<p># set alert level 90% is default<\/p>\n<p>ALERT=90<\/p>\n<p>df -HP | grep -vE &#8216;^Filesystem|tmpfs|cdrom&#8217; |<\/p>\n<p>while read partition size used free perc mnt ;<\/p>\n<p>do<\/p>\n<p>usep=$(echo $perc | tr -d &#8216;%&#8217; )<\/p>\n<p>if [ $usep -ge $ALERT ]; then<\/p>\n<p>echo &#8220;Running out of space \\&#8221;$partition ($usep%)\\&#8221; on $(hostname) as<\/p>\n<p>on $(date)&#8221; |<\/p>\n<p>mail -s &#8220;Alert: Almost out of disk space &#8211; $usep%&#8221; $ADMIN<\/p>\n<p>fi<\/p>\n<p>done<\/p>\n<p><em>Note *** change the admin123@gmail.com \u00a0to your mail id to which you want email alert<\/em><\/p>\n<p>*******************************<\/p>\n<p><em>Step 3 : make the script executable<\/em><\/p>\n<p>*******************************<\/p>\n<p>chmod 755 \/usr\/share\/diskspacealert.sh<\/p>\n<p>*******************************<\/p>\n<p><em>Step 4 : scheduling the scrip to run every day\u00a0<\/em><\/p>\n<p>*******************************<\/p>\n<p><em>Setpup a cronjob daily morning or whatever time you wish check the below link for cronjob turorial<\/em><\/p>\n<p><em>\u00a0<\/em><\/p>\n<p><em>type \u00a0crontab -e \u00a0in the linux shell<\/em><\/p>\n<p><em>then add the below line<\/em><\/p>\n<p>0 10 * * * \/usr\/share\/diskspacealert.sh<\/p>\n<p><em>this will run the script every day 10 am<\/em><\/p>\n<p><em>Note : ***<\/em><\/p>\n<p><em>you must have installed and configured\u00a0<\/em><\/p>\n<p><em>Sendmail \u00a0<\/em><\/p>\n<p><em>mailx<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Email alert when hard disk is full in linux &nbsp; \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0Most of times i will be facing mysql database crash error due to my hard disk out of space , Because of huge call Recordings in vicidial or goautodial server. so i decided to have a alert via email when ..<\/p>\n<div class=\"clear-fix\"><\/div>\n<p><a href=\"http:\/\/symbioticindia.in\/docu\/2016\/06\/03\/email-alert-on-disk-space-outage-in-linuxvicidialgoautodial-server\/\" title=\"read more...\">Read more<\/a><\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-131","post","type-post","status-publish","format-standard","hentry","category-asterisk"],"_links":{"self":[{"href":"http:\/\/symbioticindia.in\/docu\/wp-json\/wp\/v2\/posts\/131","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/symbioticindia.in\/docu\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/symbioticindia.in\/docu\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/symbioticindia.in\/docu\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"http:\/\/symbioticindia.in\/docu\/wp-json\/wp\/v2\/comments?post=131"}],"version-history":[{"count":1,"href":"http:\/\/symbioticindia.in\/docu\/wp-json\/wp\/v2\/posts\/131\/revisions"}],"predecessor-version":[{"id":132,"href":"http:\/\/symbioticindia.in\/docu\/wp-json\/wp\/v2\/posts\/131\/revisions\/132"}],"wp:attachment":[{"href":"http:\/\/symbioticindia.in\/docu\/wp-json\/wp\/v2\/media?parent=131"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/symbioticindia.in\/docu\/wp-json\/wp\/v2\/categories?post=131"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/symbioticindia.in\/docu\/wp-json\/wp\/v2\/tags?post=131"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}