Find the answer to your Linux question:
Results 1 to 1 of 1
check-errors OK 07-21-2009 10:32:39 0d 2h 1m 45s 1/4 (null) why the Status Information is null???? here is my script: /usr/local/nagios/libexec/check_errors #!/bin/bash FILE="/usr/local/nagios/libexec/err_counts.txt" if [ $# -lt 2 ] then ...
  1. #1
    Just Joined!
    Join Date
    Jun 2009
    Location
    China
    Posts
    3

    Customized-script for nagios problem

    check-errors OK 07-21-2009 10:32:39 0d 2h 1m 45s 1/4 (null)
    why the Status Information is null????

    here is my script: /usr/local/nagios/libexec/check_errors

    #!/bin/bash

    FILE="/usr/local/nagios/libexec/err_counts.txt"

    if [ $# -lt 2 ]
    then
    echo "Usage:$0 -w num1 -c num2"
    exit 777
    fi

    OK=0
    WARNING=1
    CRITICAL=2

    ERROR1=`cat err_counts.txt`


    ERROR2=`grep -i error /var/log/messages -c`


    ERROR3=`echo $[$ERROR2-$ERROR1]`


    `grep -i error /var/log/messages -c > $FILE`

    if [ $ERROR3 -lt $1 ]
    then
    echo "OK error counts $ERROR3"
    exit $OK
    fi

    if [ $ERROR3 -gt $1 -a $ERROR3 -lt $2 ]
    then
    echo "Warning error counts is $ERROR3"
    exit $WARNING
    fi


    if [ $ERROR3 -gt $2 ]
    then
    echo "Critical error counts is $ERROR3"
    exit $CRITICAL
    fi
    Last edited by criver; 07-21-2009 at 02:40 AM. Reason: edit my question

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...