Welcome to Pandora FMS Community!

Find answers, ask questions, and connect with our community around the world.

Welcome to Pandora FMS Community Forums Community support [Solved] Command execution within an alert

  • [Solved] Command execution within an alert

    Posted by JPSelter on October 26, 2009 at 13:26

    I tried to create a simple alert. When a machine doesn´t respond to an icmp ping anymore I want to get an email about this event. So I created an alert, looked into the documentation and was wondering where the “command” field is located. I can see “alert type” and “description”, but not “command”. How can I tell the alert to execute a script file?

    I chose to use the EXPECT script, it is working. I also created a script with the content the documentation gave me. But it doesn´t say how the file should be named. Is it named “smtp”? What about the original “smtp” command? I already did “chmod 700 /root/smtp” but when test-executing “./smtp” it says “permission denied”, even logged in as root. What did I do wrong here?

    Sancho replied 15 years, 4 months ago 2 Members · 4 Replies
  • 4 Replies
  • Sancho

    Administrator
    October 26, 2009 at 22:36
    2321 Karma points
    Community awards: bulb Bright ideas
    Community rank: tentacle_master_icon Tentacle Master
    Like it
    Up
    0
    Down
    Drop it
    ::

    Set 755 and make a absolute call, like /usr/share/pandora_server/util/yourscript.xxx

    Remember that if pandora is running on root user, script will be run as root, if you’re running as “nobody” script will be executed as “nobody”.

  • JPSelter

    Member
    October 27, 2009 at 14:01
    0 Karma points
    Community rank: tentacle-noob-1 Tentacle noob
    Like it
    Up
    0
    Down
    Drop it
    ::

    Ok, I´m nearly there… I found the place where to put the command, also the script (I called it /var/www/util/send_alert) is working from command line.

    But the email is not sent and I don´t know why. I think it has something to do with execute-permission. Where can I see what user is running pandora or the web-console? What command can I use to give permission? I already did “chown 755 /var/www/util/send_alert” but the email is still not sent.

    (suggestion: insert a test-button under “manage alerts” for sending alerts for tests)

  • JPSelter

    Member
    October 27, 2009 at 19:17
    0 Karma points
    Community rank: tentacle-noob-1 Tentacle noob
    Like it
    Up
    0
    Down
    Drop it
    ::

    Solved… I forgot to add the “_field1_ _field2_ _field3_” after the command.

    I guess I cannot solve my other cpuusage_all question by myself, seems more like a bug.

  • Sancho

    Administrator
    October 28, 2009 at 14:55
    2321 Karma points
    Community awards: bulb Bright ideas
    Community rank: tentacle_master_icon Tentacle Master
    Like it
    Up
    0
    Down
    Drop it
    ::

    This works (cpu all), sure. Could be a lot of things, but in this case, it’s not a bug ! 😉