<?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: help on scripting in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/help-on-scripting/m-p/3899268#M96596</link>
    <description>Hi,&lt;BR /&gt;see "man read"&lt;BR /&gt;"-r             Do not treat a backslash character in any special way.  Consider each backslash to be part of the input line."</description>
    <pubDate>Thu, 16 Nov 2006 07:05:21 GMT</pubDate>
    <dc:creator>Peter Godron</dc:creator>
    <dc:date>2006-11-16T07:05:21Z</dc:date>
    <item>
      <title>help on scripting</title>
      <link>https://community.hpe.com/t5/operating-system-linux/help-on-scripting/m-p/3899264#M96592</link>
      <description>Hey guys,&lt;BR /&gt;&lt;BR /&gt;I created a script to check file systems, I am struggling with getting the syntax correct where I create a control file with the limits then get the script to use this for $warn and $crit - ie:&lt;BR /&gt;&lt;BR /&gt;filesystem warn crit&lt;BR /&gt;/home       75%  85%&lt;BR /&gt;/tmp        80%  90%&lt;BR /&gt;/usrdump    90%  96%&lt;BR /&gt;&lt;BR /&gt;etc etc&lt;BR /&gt;&lt;BR /&gt;how can I use the warn and crit variables in my script please?&lt;BR /&gt;&lt;BR /&gt;#!/bin/ksh &lt;BR /&gt;&lt;BR /&gt;# script to check the filesystem status &lt;BR /&gt;&lt;BR /&gt;DIR=/sysadmin/scripts/admin&lt;BR /&gt;LOG=$DIR/msgfile.out&lt;BR /&gt;&lt;BR /&gt;WARN=50&lt;BR /&gt;CRIT=70&lt;BR /&gt;&amp;gt;$DIR/msgfile.out&lt;BR /&gt;&lt;BR /&gt;warning_func () {       &lt;BR /&gt;                        echo "WARNING: Filesystem Alert" &amp;gt;&amp;gt; $LOG&lt;BR /&gt;                        df|awk 'NR&amp;gt;1 &amp;amp;&amp;amp; !/\/proc$/ {print $7,$4}'|sed 's/\%//' |awk -v l1=$WARN -v l2=$CRIT '&lt;BR /&gt;                        {&lt;BR /&gt;                        if ( $2 &amp;gt; l1 )&lt;BR /&gt;                        if ( $2 &amp;lt; l2 )&lt;BR /&gt;                        print $1 " is at " $2"%"&lt;BR /&gt;                        }' &amp;gt;&amp;gt; $LOG&lt;BR /&gt;                        exit 1&lt;BR /&gt;                        }&lt;BR /&gt;        &lt;BR /&gt;critical_func () {&lt;BR /&gt;                         echo "CRITICAL: Filesystem Alert" &amp;gt;&amp;gt; $LOG&lt;BR /&gt;                         df|awk 'NR&amp;gt;1 &amp;amp;&amp;amp; !/\/proc$/ {print $7,$4}'|sed 's/\%//' |awk -v l2=$CRIT '&lt;BR /&gt;                         {&lt;BR /&gt;                         if ( $2 &amp;gt; l2 )&lt;BR /&gt;                         print $1 " is at " $2"%"&lt;BR /&gt;                         }' &amp;gt;&amp;gt; $LOG&lt;BR /&gt;                        warning_func&lt;BR /&gt;                        }&lt;BR /&gt;                &lt;BR /&gt;                for a in `df | awk 'NR&amp;gt;1 &amp;amp;&amp;amp; !/\/proc$/ {print $7,$4}'| sed s/%//g | sed s/' '/:/g`&lt;BR /&gt;                do&lt;BR /&gt;&lt;BR /&gt;                USED=`echo $a |cut -d":" -f2`&lt;BR /&gt;&lt;BR /&gt;                        if [[ $USED -gt $CRIT ]] ; then&lt;BR /&gt;&lt;BR /&gt;                                critical_func&lt;BR /&gt;                &lt;BR /&gt;                        fi      &lt;BR /&gt;                done&lt;BR /&gt;&lt;BR /&gt;warning_func&lt;BR /&gt;&lt;BR /&gt;Thanks guys.&lt;BR /&gt;&lt;BR /&gt;chris</description>
      <pubDate>Thu, 16 Nov 2006 05:21:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/help-on-scripting/m-p/3899264#M96592</guid>
      <dc:creator>lawrenzo</dc:creator>
      <dc:date>2006-11-16T05:21:10Z</dc:date>
    </item>
    <item>
      <title>Re: help on scripting</title>
      <link>https://community.hpe.com/t5/operating-system-linux/help-on-scripting/m-p/3899265#M96593</link>
      <description>Chris,&lt;BR /&gt;wrap your for a in `df ... loop into a read controlfile loop. You can then use $FS to differentiate by filesystem.&lt;BR /&gt;&lt;BR /&gt;i.e. &lt;BR /&gt;while read -r FS WARN CRIT&lt;BR /&gt;do&lt;BR /&gt;for a in `df ...&lt;BR /&gt;done &amp;lt; controlfile</description>
      <pubDate>Thu, 16 Nov 2006 05:33:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/help-on-scripting/m-p/3899265#M96593</guid>
      <dc:creator>Peter Godron</dc:creator>
      <dc:date>2006-11-16T05:33:24Z</dc:date>
    </item>
    <item>
      <title>Re: help on scripting</title>
      <link>https://community.hpe.com/t5/operating-system-linux/help-on-scripting/m-p/3899266#M96594</link>
      <description>thanks I will give this a go .....</description>
      <pubDate>Thu, 16 Nov 2006 06:31:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/help-on-scripting/m-p/3899266#M96594</guid>
      <dc:creator>lawrenzo</dc:creator>
      <dc:date>2006-11-16T06:31:32Z</dc:date>
    </item>
    <item>
      <title>Re: help on scripting</title>
      <link>https://community.hpe.com/t5/operating-system-linux/help-on-scripting/m-p/3899267#M96595</link>
      <description>can I ask what the -r means?&lt;BR /&gt;&lt;BR /&gt;cheers</description>
      <pubDate>Thu, 16 Nov 2006 06:54:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/help-on-scripting/m-p/3899267#M96595</guid>
      <dc:creator>lawrenzo</dc:creator>
      <dc:date>2006-11-16T06:54:35Z</dc:date>
    </item>
    <item>
      <title>Re: help on scripting</title>
      <link>https://community.hpe.com/t5/operating-system-linux/help-on-scripting/m-p/3899268#M96596</link>
      <description>Hi,&lt;BR /&gt;see "man read"&lt;BR /&gt;"-r             Do not treat a backslash character in any special way.  Consider each backslash to be part of the input line."</description>
      <pubDate>Thu, 16 Nov 2006 07:05:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/help-on-scripting/m-p/3899268#M96596</guid>
      <dc:creator>Peter Godron</dc:creator>
      <dc:date>2006-11-16T07:05:21Z</dc:date>
    </item>
    <item>
      <title>Re: help on scripting</title>
      <link>https://community.hpe.com/t5/operating-system-linux/help-on-scripting/m-p/3899269#M96597</link>
      <description>A couple of notes: df is very difficult to use for monitoring filesystem space. The inode information is meaningless for all but HFS filesystems. You can use the Better-DF command (bdf) to find these details. Be sure to handle the possibility of a long source device file as bdf will split the long line into two pieces. I have attached a script which will monitor all the filesystems and report once each time a filesystem exceeds a limit, then once again when it grows beyond the limit by a specific amount (ie, 90%, grows 2% = 92 94 96, etc). This prevents email floods, especially after hours.</description>
      <pubDate>Thu, 16 Nov 2006 09:21:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/help-on-scripting/m-p/3899269#M96597</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2006-11-16T09:21:43Z</dc:date>
    </item>
    <item>
      <title>Re: help on scripting</title>
      <link>https://community.hpe.com/t5/operating-system-linux/help-on-scripting/m-p/3899270#M96598</link>
      <description>ok thanks guys,&lt;BR /&gt;&lt;BR /&gt;Great script btw Bill ...</description>
      <pubDate>Thu, 16 Nov 2006 09:39:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/help-on-scripting/m-p/3899270#M96598</guid>
      <dc:creator>lawrenzo</dc:creator>
      <dc:date>2006-11-16T09:39:32Z</dc:date>
    </item>
  </channel>
</rss>

