Announcement

Collapse
No announcement yet.

Bash Script - IF conditional doubt

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Bash Script - IF conditional doubt

    Hi everybody,

    I need to request your assistance with a bash plugin I am trying to make work on Centreon.

    Actually, on the command line it works fine, but when applying to centreon it does not. Upon checking, I have discovered the "if" conditional is not working on centreon side (very strange!)

    Script:

    #!/bin/bash
    var=$(./check_mysql_query -u centreon -p centreon -d centreon -q "SELECT cant FROM lock WHERE id='1' AND status='OK'" | awk '{print $2}')
    value=$(./check_mysql_query -u centreon -p centreon -d centreon -q "SELECT cant FROM lock WHERE id='1' AND status='OK'" | awk '{print $12}')

    if [ $var == "OK:" ]
    then
    echo "OK - No locks"
    exit 0
    fi

    if [ $var == "WARNING:" ]
    then
    echo "WARN! $value locks in dB"
    exit 1
    fi



    Has anybody faced this issue?

    Regards,
    Attached Files
Working...
X