<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: File System Alert Script in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/file-system-alert-script/m-p/3020599#M75723</link>
    <description>Ok, thanks alot guys. That should do it for my question. Thanks for all the help from both of you.</description>
    <pubDate>Fri, 11 Jul 2003 11:57:29 GMT</pubDate>
    <dc:creator>Kyle D. Harris</dc:creator>
    <dc:date>2003-07-11T11:57:29Z</dc:date>
    <item>
      <title>File System Alert Script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/file-system-alert-script/m-p/3020589#M75713</link>
      <description>Here's what i'm looking to do: &lt;BR /&gt;&lt;BR /&gt;Write a small script to send out a email notification to myself when a filesystem reaches a certain percent (say 96 %). I'm pretty sure i'd have to use the df command to go with the "awk" command to pull the % field. Can somebody give me a little help? The awk command is kicking my a$$.... Thanks alot to all! &lt;BR /&gt;&lt;BR /&gt;Kyle Harris</description>
      <pubDate>Thu, 10 Jul 2003 17:59:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/file-system-alert-script/m-p/3020589#M75713</guid>
      <dc:creator>Kyle D. Harris</dc:creator>
      <dc:date>2003-07-10T17:59:17Z</dc:date>
    </item>
    <item>
      <title>Re: File System Alert Script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/file-system-alert-script/m-p/3020590#M75714</link>
      <description>++++++++++++cut here++++++++++++++&lt;BR /&gt;#!/usr/bin/awk -f&lt;BR /&gt;&lt;BR /&gt;BEGIN { &lt;BR /&gt;&lt;BR /&gt;#Skip the initial header output of bdf&lt;BR /&gt;getline &lt;BR /&gt;&lt;BR /&gt;#set flag to do one time echoing stuff&lt;BR /&gt; flag=0&lt;BR /&gt;&lt;BR /&gt;#The argument passed to this script is a path whose last few characters &lt;BR /&gt;#contain the hostname. Find the exact hostname&lt;BR /&gt; a = index(FILENAME,"tmp\/")&lt;BR /&gt; b=substr(FILENAME,a+4)&lt;BR /&gt;}&lt;BR /&gt;{ &lt;BR /&gt;&lt;BR /&gt;#Ignore some stuff like /net etc...&lt;BR /&gt;if (NF &amp;gt; 5) {&lt;BR /&gt;print substr($5,1,length($5)-1)&lt;BR /&gt;&lt;BR /&gt;#Remove the % symbol and check if usage is more than 90%&lt;BR /&gt; if ( int(substr($5,1,length($5)-1)) &amp;gt;= 90 ) { &lt;BR /&gt;&lt;BR /&gt;#Check for flag to print header in mail&lt;BR /&gt;  if ( flag == 0 ) {&lt;BR /&gt;     print "The following file system(s) are more than 90% full for " b&lt;BR /&gt;     flag=1&lt;BR /&gt;  }&lt;BR /&gt;#Print mountpoint, usage,....&lt;BR /&gt;  print $1 "\t\t" $5 "\t\t"  $6&lt;BR /&gt; }&lt;BR /&gt;  }&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;END {&lt;BR /&gt;#Formatting stuff&lt;BR /&gt; if ( flag == 1) {&lt;BR /&gt;  print "================="&lt;BR /&gt; }&lt;BR /&gt;}&lt;BR /&gt;++++++++++++end cut++++++++++++++&lt;BR /&gt;&lt;BR /&gt;Pipe the output of bdf to this script and watch the output. &lt;BR /&gt;&lt;BR /&gt;cheerio&lt;BR /&gt;-balaji</description>
      <pubDate>Thu, 10 Jul 2003 18:10:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/file-system-alert-script/m-p/3020590#M75714</guid>
      <dc:creator>Balaji N</dc:creator>
      <dc:date>2003-07-10T18:10:43Z</dc:date>
    </item>
    <item>
      <title>Re: File System Alert Script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/file-system-alert-script/m-p/3020591#M75715</link>
      <description>Belaji, &lt;BR /&gt;   Linux doesn't have a BDF command. It's "df" in linux. Anyway, that looked pretty complex, but if it works it works. I imagined it would only be about 5 or 6 lines for the whole script.</description>
      <pubDate>Thu, 10 Jul 2003 18:24:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/file-system-alert-script/m-p/3020591#M75715</guid>
      <dc:creator>Kyle D. Harris</dc:creator>
      <dc:date>2003-07-10T18:24:49Z</dc:date>
    </item>
    <item>
      <title>Re: File System Alert Script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/file-system-alert-script/m-p/3020592#M75716</link>
      <description>hey &lt;BR /&gt;sorry. this was a script which i used to use in the HP unix environment.&lt;BR /&gt;&lt;BR /&gt;do this. &lt;BR /&gt;&lt;BR /&gt;run df -h and save it a file.&lt;BR /&gt;&lt;BR /&gt;save this snippet as some script.awk.&lt;BR /&gt;&lt;BR /&gt;and run script.awk &lt;FILENAME&gt;&lt;BR /&gt;&lt;BR /&gt;if the filesystem size is greater than 90% it fill fill them.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;i have a script which actually does an remsh into  a list of hosts and calls this script for every host.&lt;BR /&gt;&lt;BR /&gt;and sends a consolidated mail from it.&lt;BR /&gt;&lt;BR /&gt;am leaving home in the next ten minutes. so if u need any more info, reply quickly.&lt;BR /&gt;&lt;BR /&gt;cheerio&lt;BR /&gt;-balaji&lt;/FILENAME&gt;</description>
      <pubDate>Thu, 10 Jul 2003 18:35:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/file-system-alert-script/m-p/3020592#M75716</guid>
      <dc:creator>Balaji N</dc:creator>
      <dc:date>2003-07-10T18:35:42Z</dc:date>
    </item>
    <item>
      <title>Re: File System Alert Script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/file-system-alert-script/m-p/3020593#M75717</link>
      <description>I should be ok man. I'll be leaving work soon so i'll check your stuff out tomorrow. Thanks again. Pts were rewarded!..&lt;BR /&gt;&lt;BR /&gt;Kyle</description>
      <pubDate>Thu, 10 Jul 2003 18:38:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/file-system-alert-script/m-p/3020593#M75717</guid>
      <dc:creator>Kyle D. Harris</dc:creator>
      <dc:date>2003-07-10T18:38:23Z</dc:date>
    </item>
    <item>
      <title>Re: File System Alert Script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/file-system-alert-script/m-p/3020594#M75718</link>
      <description>and here is a one liner for your work. modify accordingly.&lt;BR /&gt;&lt;BR /&gt;df -k | awk '{if (int(substr($5,1,length($5)-1)) &amp;gt;= 90) { print $1 " is " $5 " full"}}'&lt;BR /&gt;&lt;BR /&gt;cheers&lt;BR /&gt;-balaji&lt;BR /&gt;</description>
      <pubDate>Thu, 10 Jul 2003 18:39:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/file-system-alert-script/m-p/3020594#M75718</guid>
      <dc:creator>Balaji N</dc:creator>
      <dc:date>2003-07-10T18:39:38Z</dc:date>
    </item>
    <item>
      <title>Re: File System Alert Script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/file-system-alert-script/m-p/3020595#M75719</link>
      <description>oh! no issues and thanks for the pts.&lt;BR /&gt;-balaji</description>
      <pubDate>Thu, 10 Jul 2003 18:40:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/file-system-alert-script/m-p/3020595#M75719</guid>
      <dc:creator>Balaji N</dc:creator>
      <dc:date>2003-07-10T18:40:20Z</dc:date>
    </item>
    <item>
      <title>Re: File System Alert Script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/file-system-alert-script/m-p/3020596#M75720</link>
      <description>Here is a script I put together that should suit your needs... you'll need to change a few minot things such as the send to address and figure out how often you want the script to run.  But other than that I've tested this on my red hat box&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;mark=1&lt;BR /&gt;while [ $mark = 1 ]&lt;BR /&gt;do&lt;BR /&gt;df |&lt;BR /&gt;while read a b c d e f&lt;BR /&gt;do&lt;BR /&gt;MTP=$(echo $f | grep -v "Mounted on")&lt;BR /&gt;USE=$(echo $e | grep -v Use | sed 's/.$//g')&lt;BR /&gt;if [ "$USE" &amp;gt;= "96" ]&lt;BR /&gt;then&lt;BR /&gt;echo "$MTP $USE " | mailx -s "FS alert" sendto@work.com&lt;BR /&gt;sleep 100 #or whatever time&lt;BR /&gt;else&lt;BR /&gt;sleep 100 #or whatever time&lt;BR /&gt;fi&lt;BR /&gt;done&lt;BR /&gt;done</description>
      <pubDate>Thu, 10 Jul 2003 19:17:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/file-system-alert-script/m-p/3020596#M75720</guid>
      <dc:creator>John Meissner</dc:creator>
      <dc:date>2003-07-10T19:17:49Z</dc:date>
    </item>
    <item>
      <title>Re: File System Alert Script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/file-system-alert-script/m-p/3020597#M75721</link>
      <description>One more question... When you guys say greater then 90, i know your talking about the percent of a particular file system. Since the "df" command shows it 90% will it recognize 90 or not since the percent sign is immediately following it? Thanks. &lt;BR /&gt;&lt;BR /&gt;Kyle</description>
      <pubDate>Fri, 11 Jul 2003 11:39:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/file-system-alert-script/m-p/3020597#M75721</guid>
      <dc:creator>Kyle D. Harris</dc:creator>
      <dc:date>2003-07-11T11:39:47Z</dc:date>
    </item>
    <item>
      <title>Re: File System Alert Script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/file-system-alert-script/m-p/3020598#M75722</link>
      <description>if u see mine, here is the part which strips the % and uses that as a no.&lt;BR /&gt;&lt;BR /&gt;int(substr($5,1,length($5)-1)) &lt;BR /&gt;&lt;BR /&gt;-balaji</description>
      <pubDate>Fri, 11 Jul 2003 11:54:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/file-system-alert-script/m-p/3020598#M75722</guid>
      <dc:creator>Balaji N</dc:creator>
      <dc:date>2003-07-11T11:54:58Z</dc:date>
    </item>
    <item>
      <title>Re: File System Alert Script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/file-system-alert-script/m-p/3020599#M75723</link>
      <description>Ok, thanks alot guys. That should do it for my question. Thanks for all the help from both of you.</description>
      <pubDate>Fri, 11 Jul 2003 11:57:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/file-system-alert-script/m-p/3020599#M75723</guid>
      <dc:creator>Kyle D. Harris</dc:creator>
      <dc:date>2003-07-11T11:57:29Z</dc:date>
    </item>
    <item>
      <title>Re: File System Alert Script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/file-system-alert-script/m-p/3020600#M75724</link>
      <description>Hello &lt;BR /&gt;&lt;BR /&gt;I am using this attached perl script to do the job &lt;BR /&gt;&lt;BR /&gt;Some one in this forums did post a script very much like this one but for HP-UX os I did modify it to run on my linux.&lt;BR /&gt;I did quite a bite of modification, but I am afraid I do not remember who the original writer&lt;BR /&gt;is ...&lt;BR /&gt;&lt;BR /&gt;I am just posting this modified version because it did teach me a fews tricks in perl, and I thing it could be usefull to you&lt;BR /&gt;&lt;BR /&gt;modify reportfull and email_users in the script to your needs,&lt;BR /&gt;&lt;BR /&gt;Jean-Pierre &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 11 Jul 2003 12:28:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/file-system-alert-script/m-p/3020600#M75724</guid>
      <dc:creator>Huc_1</dc:creator>
      <dc:date>2003-07-11T12:28:24Z</dc:date>
    </item>
    <item>
      <title>Re: File System Alert Script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/file-system-alert-script/m-p/3020601#M75725</link>
      <description>Kyle... in my script above i use SED to cut off the % symbol... so it's looking at the number.</description>
      <pubDate>Fri, 11 Jul 2003 13:23:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/file-system-alert-script/m-p/3020601#M75725</guid>
      <dc:creator>John Meissner</dc:creator>
      <dc:date>2003-07-11T13:23:54Z</dc:date>
    </item>
    <item>
      <title>Re: File System Alert Script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/file-system-alert-script/m-p/3020602#M75726</link>
      <description>John, i copy pasted your script. I changed the percent to 85 and of course my email address in the sendx .... I have one file system at 88 percent, thus i made the percent 85 just to see if it works. I also included: "#!/usr/bin/perl" at the top of the script. I'm still having trouble getting it to work correctly. Any other ideas i may not be doing correctly? Thanks. &lt;BR /&gt;&lt;BR /&gt;Kyle</description>
      <pubDate>Fri, 11 Jul 2003 13:54:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/file-system-alert-script/m-p/3020602#M75726</guid>
      <dc:creator>Kyle D. Harris</dc:creator>
      <dc:date>2003-07-11T13:54:26Z</dc:date>
    </item>
    <item>
      <title>Re: File System Alert Script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/file-system-alert-script/m-p/3020603#M75727</link>
      <description>hi&lt;BR /&gt;john's script is a simple shell script.&lt;BR /&gt;&lt;BR /&gt;so u need to add the line #!/usr/bin/sh on top.&lt;BR /&gt;&lt;BR /&gt;cheerio&lt;BR /&gt;-balaji</description>
      <pubDate>Fri, 11 Jul 2003 14:17:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/file-system-alert-script/m-p/3020603#M75727</guid>
      <dc:creator>Balaji N</dc:creator>
      <dc:date>2003-07-11T14:17:38Z</dc:date>
    </item>
    <item>
      <title>Re: File System Alert Script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/file-system-alert-script/m-p/3020604#M75728</link>
      <description>i actually prefer using the top line of&lt;BR /&gt;&lt;BR /&gt;#! /usr/bin/ksh&lt;BR /&gt;&lt;BR /&gt;I just like the korn shell...</description>
      <pubDate>Fri, 11 Jul 2003 16:42:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/file-system-alert-script/m-p/3020604#M75728</guid>
      <dc:creator>John Meissner</dc:creator>
      <dc:date>2003-07-11T16:42:13Z</dc:date>
    </item>
    <item>
      <title>Re: File System Alert Script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/file-system-alert-script/m-p/3020605#M75729</link>
      <description>OK - sorry... i had a problem in my script..... i fixed it... here it is...:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;mark=1&lt;BR /&gt;while [ $mark = 1 ]&lt;BR /&gt;do&lt;BR /&gt;df | grep -v Filesystem |&lt;BR /&gt;while read line&lt;BR /&gt;do&lt;BR /&gt;MTP=$(echo "$line" | awk '{print $6}')&lt;BR /&gt;USE=$(echo "$line" | awk '{print $5}' | sed 's/.$//g')&lt;BR /&gt;if [ "$USE" &amp;gt; "60" ]&lt;BR /&gt;then&lt;BR /&gt;echo "$MTP $USE " | mailx -s "FS alert" sendto@work.com&lt;BR /&gt;sleep 100 #or whatever time&lt;BR /&gt;else&lt;BR /&gt;sleep 100 #or whatever time&lt;BR /&gt;fi&lt;BR /&gt;done&lt;BR /&gt;done&lt;BR /&gt;</description>
      <pubDate>Fri, 11 Jul 2003 17:04:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/file-system-alert-script/m-p/3020605#M75729</guid>
      <dc:creator>John Meissner</dc:creator>
      <dc:date>2003-07-11T17:04:06Z</dc:date>
    </item>
  </channel>
</rss>

