<?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: check filesystem usage script in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/check-filesystem-usage-script/m-p/5006320#M98799</link>
    <description>df|awk 'NR&amp;gt;1 &amp;amp;&amp;amp; !/\/proc$/ {print $7,$4}'|sed 's/\%//'|awk -v WARN=10 -v CRIT=40 '&lt;BR /&gt;{&lt;BR /&gt;if ( $2 &amp;gt; WARN )&lt;BR /&gt;if ( $2 &amp;lt; CRIT )&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Yang</description>
    <pubDate>Tue, 03 Oct 2006 07:32:05 GMT</pubDate>
    <dc:creator>Yang Qin_1</dc:creator>
    <dc:date>2006-10-03T07:32:05Z</dc:date>
    <item>
      <title>check filesystem usage script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/check-filesystem-usage-script/m-p/5006316#M98795</link>
      <description>Hello,&lt;BR /&gt;&lt;BR /&gt;I have closed a previous thread and started this one as this should be more clear for what I require.&lt;BR /&gt;&lt;BR /&gt;I want to create a script that prints the output to a file to be read by another program.&lt;BR /&gt;&lt;BR /&gt;I want the filesystem usage to be recorded when a critical threshold and a warning threshold have been exceed.&lt;BR /&gt;&lt;BR /&gt;here is a start to what i need ( this is on Linux)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;DIR=/sysadmin/scripts/admin&lt;BR /&gt;LOG=$DIR/msgfile.out&lt;BR /&gt;&lt;BR /&gt;WARN=70&lt;BR /&gt;CRIT=90&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;CMD=`df|awk 'NR&amp;gt;1 &amp;amp;&amp;amp; !/\/proc$/ {print $7,$4}'|sed -e s/%//g -e s/' '/:/g`&lt;BR /&gt;               &lt;BR /&gt;FILESYS=`echo $CMD | cut -d":" -f1`&lt;BR /&gt;USED=`echo $CMD | cut -d":" -f2`&lt;BR /&gt;&lt;BR /&gt;how can I create the output so the file looks something like:&lt;BR /&gt;&lt;BR /&gt;WARNING ###########&lt;BR /&gt;&lt;BR /&gt;/ is at 78%&lt;BR /&gt;/home is at 89%&lt;BR /&gt;&lt;BR /&gt;CRITICAL ##########&lt;BR /&gt;&lt;BR /&gt;/tmp is a 98%&lt;BR /&gt;/var is at 92%&lt;BR /&gt;</description>
      <pubDate>Mon, 02 Oct 2006 08:24:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/check-filesystem-usage-script/m-p/5006316#M98795</guid>
      <dc:creator>lawrenzo_1</dc:creator>
      <dc:date>2006-10-02T08:24:22Z</dc:date>
    </item>
    <item>
      <title>Re: check filesystem usage script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/check-filesystem-usage-script/m-p/5006317#M98796</link>
      <description>df on my HP server does not produce the same output as youlisted. I use bdf:&lt;BR /&gt;&lt;BR /&gt;#!/bin/ksh&lt;BR /&gt;&lt;BR /&gt;DIR=/sysadmin/scripts/admin&lt;BR /&gt;LOG=$DIR/msgfile.out&lt;BR /&gt;&lt;BR /&gt;echo "####### WARNING ###########" &amp;gt; $LOG&lt;BR /&gt;&lt;BR /&gt;bdf | grep -v "\/proc" | awk ' {print $5 " " $6} ' | sed 's/\%//'|awk '&lt;BR /&gt;{&lt;BR /&gt;if ( $1 &amp;gt; 50 )&lt;BR /&gt;if ( $1 &amp;lt; 80 )&lt;BR /&gt;print $2 " is at " $1 "%"&lt;BR /&gt;} ' &amp;gt;&amp;gt; $LOG&lt;BR /&gt;&lt;BR /&gt;echo "####### CRITICAL ###########" &amp;gt;&amp;gt; $LOG&lt;BR /&gt;&lt;BR /&gt;bdf | grep -v "\/proc" | awk ' {print $5 " " $6} ' | sed 's/\%//'|awk '&lt;BR /&gt;{&lt;BR /&gt;if ( $1 &amp;gt; 80 )&lt;BR /&gt;print $2 " is at " $1 "%"&lt;BR /&gt;} ' &amp;gt;&amp;gt; $LOG&lt;BR /&gt;&lt;BR /&gt;exit&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Yang</description>
      <pubDate>Mon, 02 Oct 2006 08:27:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/check-filesystem-usage-script/m-p/5006317#M98796</guid>
      <dc:creator>Yang Qin_1</dc:creator>
      <dc:date>2006-10-02T08:27:32Z</dc:date>
    </item>
    <item>
      <title>Re: check filesystem usage script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/check-filesystem-usage-script/m-p/5006318#M98797</link>
      <description>&lt;!--!*#--&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;I make use of Bill Hassell's bdfmegs script to ensure 'bdf' output contains one line per filesystem.&lt;BR /&gt;&lt;BR /&gt;# cat fs_warn.awk&lt;BR /&gt;BEGIN {&lt;BR /&gt;  match=0;&lt;BR /&gt;}&lt;BR /&gt;{&lt;BR /&gt;if (NR &amp;gt; 1)&lt;BR /&gt;{&lt;BR /&gt;  sub(/\%/,"");&lt;BR /&gt;}&lt;BR /&gt;if ($5&amp;gt;=70 &amp;amp;&amp;amp; $5&amp;lt;90)&lt;BR /&gt;{&lt;BR /&gt;  if (matched==0)&lt;BR /&gt;  {&lt;BR /&gt;    print "####### WARNING #######";&lt;BR /&gt;    matched=1;&lt;BR /&gt;  }&lt;BR /&gt;  print $6, "is at", $5"%";&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;# cat fs_crit.awk&lt;BR /&gt;BEGIN {&lt;BR /&gt;  match=0;&lt;BR /&gt;}&lt;BR /&gt;{&lt;BR /&gt;if (NR &amp;gt; 1)&lt;BR /&gt;{&lt;BR /&gt;  sub(/\%/,"");&lt;BR /&gt;}&lt;BR /&gt;if ($5&amp;gt;=90)&lt;BR /&gt;{&lt;BR /&gt;  if (matched==0)&lt;BR /&gt;  {&lt;BR /&gt;    print "####### CRITICAL #######";&lt;BR /&gt;    matched=1;&lt;BR /&gt;  }&lt;BR /&gt;  print $6, "is at", $5"%";&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;# bdfmegs.sh | awk -f fs_warn.awk &amp;gt; logfile&lt;BR /&gt;# bdfmegs.sh | awk -f fs_crit.awk &amp;gt;&amp;gt; logfile&lt;BR /&gt;&lt;BR /&gt;PCS</description>
      <pubDate>Mon, 02 Oct 2006 09:17:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/check-filesystem-usage-script/m-p/5006318#M98797</guid>
      <dc:creator>spex</dc:creator>
      <dc:date>2006-10-02T09:17:12Z</dc:date>
    </item>
    <item>
      <title>Re: check filesystem usage script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/check-filesystem-usage-script/m-p/5006319#M98798</link>
      <description>how can i get the $VAR to be used with the awk statement:&lt;BR /&gt;&lt;BR /&gt;WARN=10&lt;BR /&gt;CRIT=40&lt;BR /&gt;&lt;BR /&gt;df|awk 'NR&amp;gt;1 &amp;amp;&amp;amp; !/\/proc$/ {print $7,$4}'|sed 's/\%//'|awk '&lt;BR /&gt;                        {&lt;BR /&gt;if ( $2 &amp;gt; $WARN )&lt;BR /&gt;if ( $2 &amp;lt; $CRIT )&lt;BR /&gt;&lt;BR /&gt;currently i have to use :&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;if ( $2 &amp;gt; 10 )&lt;BR /&gt;if ( $2 &amp;lt; 40 )&lt;BR /&gt;&lt;BR /&gt;i have created a file with the various limits for $WARN and $CRIT therefore the setting entered into the awk will not always be the case.&lt;BR /&gt;&lt;BR /&gt;thanks in advance&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 03 Oct 2006 07:02:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/check-filesystem-usage-script/m-p/5006319#M98798</guid>
      <dc:creator>lawrenzo_1</dc:creator>
      <dc:date>2006-10-03T07:02:21Z</dc:date>
    </item>
    <item>
      <title>Re: check filesystem usage script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/check-filesystem-usage-script/m-p/5006320#M98799</link>
      <description>df|awk 'NR&amp;gt;1 &amp;amp;&amp;amp; !/\/proc$/ {print $7,$4}'|sed 's/\%//'|awk -v WARN=10 -v CRIT=40 '&lt;BR /&gt;{&lt;BR /&gt;if ( $2 &amp;gt; WARN )&lt;BR /&gt;if ( $2 &amp;lt; CRIT )&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Yang</description>
      <pubDate>Tue, 03 Oct 2006 07:32:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/check-filesystem-usage-script/m-p/5006320#M98799</guid>
      <dc:creator>Yang Qin_1</dc:creator>
      <dc:date>2006-10-03T07:32:05Z</dc:date>
    </item>
    <item>
      <title>Re: check filesystem usage script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/check-filesystem-usage-script/m-p/5006321#M98800</link>
      <description>Or you may want this one:&lt;BR /&gt;&lt;BR /&gt;WARN=10&lt;BR /&gt;CRIT=40&lt;BR /&gt;&lt;BR /&gt;df|awk 'NR&amp;gt;1 &amp;amp;&amp;amp; !/\/proc$/ {print $7,$4}'|sed 's/\%//'|awk -v v1=$WARN -v v2=$CRIT '&lt;BR /&gt;{&lt;BR /&gt;if ( $2 &amp;gt; v1 )&lt;BR /&gt;if ( $2 &amp;lt; v2 )&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Yang</description>
      <pubDate>Tue, 03 Oct 2006 08:13:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/check-filesystem-usage-script/m-p/5006321#M98800</guid>
      <dc:creator>Yang Qin_1</dc:creator>
      <dc:date>2006-10-03T08:13:46Z</dc:date>
    </item>
    <item>
      <title>Re: check filesystem usage script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/check-filesystem-usage-script/m-p/5006322#M98801</link>
      <description>Thanks man - thats it!&lt;BR /&gt;&lt;BR /&gt;Chris</description>
      <pubDate>Wed, 04 Oct 2006 07:35:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/check-filesystem-usage-script/m-p/5006322#M98801</guid>
      <dc:creator>lawrenzo_1</dc:creator>
      <dc:date>2006-10-04T07:35:43Z</dc:date>
    </item>
  </channel>
</rss>

