Announcement

Collapse
No announcement yet.

Why centreon command does not work properly while plugin is correct?

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

  • Why centreon command does not work properly while plugin is correct?

    Hello, I am writing a simple plugin that is checking a presence of index.html file on a remote machine.

    When I run my script it is perfectly executed and I have a positive response (exit 0), while when I create a command in centreon - it seems that plugin works however it returns a warning message (exit 1).

    {"data-align":"none","data-size":"full","title":"2019-06-28_11-52-48.png","data-attachmentid":154236}

    And the script itself is the following:

    Code:
    #!/bin/bash
    answer=$(sshpass -p "password" ssh $1 test -f "/var/www/html/index.html" && echo "File found" || echo "File not found");
    
    case $answer in
    
    "File found")
    echo "YES FILE index.html FOUND"
    exit 0
    ;;
    "File not found")
    echo "THERE IS NO FILE index.html"
    exit 1
    ;;
    *)
    echo "UNKNOWN"
    exit 3
    ;;
    esac
    I do not understand what is wrong.
Working...
X