Announcement

Collapse
No announcement yet.

Bash script is not returning variable

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

  • Bash script is not returning variable

    Hello,

    I try to make a bash script for centreon.
    Here's the script

    #!/bin/bash

    if [[ -z "$1" ]]
    then
    echo "PARAMETRE MANQUANT"
    exit 3
    fi

    SWITCH="$1"

    result=`./check_snmp -C public -v 2c -H $SWITCH -o .1.3.6.1.4.1.11.2.14.11.5.1.9.12.1.0 | grep "SNMP" | awk '{print $4}'`
    if [ $result -gt 500 ]
    then
    echo "CRITICAL - TENTATIVE D'ARP SPOOFING : $result"
    exit 2
    else
    if [ $result -gt 300 ]
    then
    echo "WARNING - Checker CAMTABLE de $SWITCH : $result"
    exit 1
    fi
    fi
    echo "OK - CAMTable $result"
    exit 0
    Here's the result. I do not see $result. Am i missing something? thanks for help.

    centreon.png

    centreon.png
    Last edited by alexraimb; 2 weeks ago.

  • #2
    Found.
    ./check_snmp.... works better with absolute path.
    Topic closed

    Comment

    Working...
    X