e confirma as permissões tb.


Jose Oliveira wrote:
> Luis
>
> Na saída do seu script, quando está testando se o resultado obtido é OK,
> WARNING ou CRITICAL, o script deve terminar com exit 0, 1 ou 2 conforme a
> situação estiver OK, WARNING ou CRITICAL...
>
> Quanto ao null, veja se o script retorna somente uma linha. O Nágios só
> mostra na interface uma linha, mesmo que ela seja relativamente grande. Se
> for grande, o browser se encarrega de quebrá-la...
>
> []s
>
>
>
> 2010/6/8 Luis Henrique <lsi...@bionexo.com>
>
>   
>> Boa Tarde pessoal...
>> Estou tendo um problema com o Nagios, Fiz um script, que na linha de
>> comando ele funciona, Más quando coloco para o Nagios monitorar ele da
>> mensagem de Null e fica verde, Alguem pode me ajudar???
>> Segue o script, (Este script server para pegar a memoria total do PC /
>> free -mt, e transforma em porcentagem.
>> ###################################################################
>> # Script to check real memory usage
>> # L.Henrique 07/06/10 - V.2.0
>> # ------------------------------------------
>> # ########  Script Modifications  ##########
>> # ------------------------------------------
>> #!/bin/bash
>> USAGE="`basename $0` [-w|--warning]<percent free>
>> [-c|--critical]<percent free>"
>> THRESHOLD_USAGE="WARNING threshold must be greater than CRITICAL:
>> `basename $0` $*"
>> calc=/tmp/totalcalc
>>
>> percent_free=/tmp/freepercent
>>
>> critical=""
>>
>> warning=""
>>
>> STATE_OK=0
>>
>> STATE_WARNING=1
>>
>> STATE_CRITICAL=2
>>
>> STATE_UNKNOWN=3
>>
>> # print
>> usage
>> if [[ $# -lt 4
>> ]]
>> then
>>
>>        echo
>> ""
>>        echo "Wrong Syntax: `basename $0`
>> $*"
>>        echo
>> ""
>>        echo "Usage:
>> $USAGE"
>>        echo
>> ""
>>        exit
>> 0
>> fi
>>
>> # read
>> input
>> while [[ $# -gt 0
>> ]]
>> do
>>
>> case "$1"
>> in
>> -w|--warning)
>>
>> shift
>>
>> warning=$1
>>
>> ;;
>>
>> -c|--critical)
>>
>> shift
>>
>> critical=$1
>>
>> ;;
>>
>> esac
>>
>> shift
>>
>>
>> done
>>
>> # verify
>> input
>> if [[ $warning -eq $critical || $warning -lt $critical
>> ]]
>> then
>>
>>              echo
>> ""
>>              echo
>> "$THRESHOLD_USAGE"
>>              echo
>> ""
>>              echo "Usage:
>> $USAGE"
>>              echo
>> ""
>> exit
>> 0
>>
>> fi
>>
>> # Total memory
>> available
>> total=`free -mt | grep 'Total:' | awk '{print
>> $3}'`
>> # Total memory
>> used
>> used=`free -mt | grep 'Total:' | awk '{print
>> $2}'`
>> # Calc total minus
>> used
>> free=`free -mt | grep 'Total:' | awk '{print
>> $2-$3}'`
>> # normal
>> values
>> #echo "$total"MB
>> total
>> #echo "$used"MB
>> used
>> #echo "$free"MB
>> free
>> # make it into % percent free = ((used  /  total) *
>> 100)
>>              echo "5" > $calc # decimal
>> accuracy
>>              echo "k" >> $calc # commit
>>              echo "100" >> $calc # multiply
>>              echo "$total" >> $calc # division integer
>>              echo "$used" >> $calc # division integer
>>              echo "/" >> $calc # division sign
>>              echo "*" >> $calc # multiplication sign
>>              echo "p" >> $calc # print
>> percent=`/usr/bin/dc $calc|/bin/sed 's/^\./0./'|/usr/bin/tr "." "
>> "|/usr/bin/gawk {'print $1'}`
>> #percent1=`/usr/bin/dc $calc`
>> #echo "$percent1"
>> if [[ "$percent" -le  $critical ]]
>>          then
>>                  echo "CRITICAL-$free MB Free ($percent% Used Memory)"
>>                  exit 0
>> fi
>> if [[ "$percent" -le  $warning ]]
>>          then
>>                  echo "WARNING-$free MB Free ($percent% Used Memory)"
>>                  exit 0
>> fi
>> if [[ "$percent" -gt  $warning ]]
>>          then
>>                  echo "OK-$free MB Free ($percent% Used Memory)"
>>                  exit 0
>> ###################################################################
>> Command.cfg
>>
>> #Teste ckeck_mem
>> define command{
>>        command_name    check_mem
>>        command_line    $USER1$/check_mem -w $ARG1$ -c $ARG2$
>> }
>>
>> ###################################################################
>> Erro Nagios:
>>
>> Memoria Real
>> <
>> http://bio00378/nagios/cgi-bin/extinfo.cgi?type=2&host=localhost&service=Memoria+Real
>>     
>>
>>
>>        OK      06-08-2010 15:08:55     0d 0h 16m 52s   1/4     (null)
>>
>>
>>
>> --
>> - ________________________________
>> Luis Henrique
>> Tecnologia da Informação
>> Bionexo do Brasil
>> 55 11 3133-8110
>> lsi...@bionexo.com
>>
>> www.bionexo.com.br
>> Av.: Luiz Carlos Berrini, 936,
>> 12° andar Novo Brooklin - São Paulo - SP
>>
>>
>>
>> ------------------------------------------------------------------------------
>> ThinkGeek and WIRED's GeekDad team up for the Ultimate
>> GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
>> lucky parental unit.  See the prize list and enter to win:
>> http://p.sf.net/sfu/thinkgeek-promo
>> --
>> Nagios-users-br@lists.sourceforge.net mailing list
>> https://lists.sourceforge.net/lists/listinfo/nagios-users-br
>> Wiki: http://nagios-br.sf.net/wiki
>>
>>     
>
>
>
>   

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
-- 
Nagios-users-br@lists.sourceforge.net mailing list
https://lists.sourceforge.net/lists/listinfo/nagios-users-br
Wiki: http://nagios-br.sf.net/wiki

Responder a