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 Advanced troubleshooting Scripts associated with SNMP alerts no longer run when SNMP traps are received

  • Scripts associated with SNMP alerts no longer run when SNMP traps are received

    Posted by Christophe on January 5, 2023 at 09:49

    When we send an SNMP trap on the server, it is displayed in the SNMP console and the associated SNMP alert is triggered but the Python script does not run, does not modify the agents and does not write the messages in the log file. However, when we execute the script on the command line, it works, the agents in Pandora are updated and the messages in the log appear. In the file “pandora_server.log” we have the following message: “2023-01-04 12:00:22 Core: ip-10-61-4-225.eu-west-3.<wbr>compute.internal [V3] Action ‘launch SNMP script EMB’ alert ” agent ” exceeded the global alert timeout 15 seconds” . However, the modules we send do not contain empty values. We have already tried several times to restart the server and the Pandora process in vain. Do you know where this problem can come from?

    Christophe replied 1 year, 3 months ago 2 Members · 6 Replies
  • 6 Replies
  • vic

    Administrator
    January 5, 2023 at 10:46
    1306 Karma points
    Community awards: bulb Bright ideas
    Community rank: tentacle_master_icon Tentacle Master
    Like it
    Up
    1
    Down
    Drop it
    ::

    Hi Christophe,

    Have you checked how long it takes to run the Python script ?

    If it takes more than 15 seconds, it is possible that the server will discard it because of the timeout, so we recommend that you check the timeout in the Pandora FMS server conf.

    /etc/pandora/pandora_server.conf

    # Maximum executing time of an alert (in seconds)

    global_alert_timeout 15

    Best regards,

    Vic.

    • Christophe

      Member
      January 5, 2023 at 11:23
      324 Karma points
      Community rank: tentacle-noob-1 Tentacle noob
      Like it
      Up
      0
      Down
      Drop it
      ::

      Hello Vic,

      Thank you for your quick answer.

      When we run the script by hand in the server console, it takes less than a second to respond. We have been using this same script for several months and it has always worked fine until now. We have the same problem with all the scripts that worked before (without having touched the “global_alert_timeout” setting).

      Best regards.

  • vic

    Administrator
    January 12, 2023 at 09:21
    1306 Karma points
    Community awards: bulb Bright ideas
    Community rank: tentacle_master_icon Tentacle Master
    Like it
    Up
    0
    Down
    Drop it
    ::

    Hi,

    Can you make sure that the Pandora FMS server has permissions to execute this script?

    A recommendation is to move the script to the following directory “/usr/share/pandora_server/util/plugin/” and give it the following permissions:

    -rwxr-xr-x pandora root

    In case it doesn’t execute it, increase the server verbosity to 10 and restart the server process and try to force the module a couple of times, so the server will write in the server log and we could see the cause.

    Best regards,

    Víc.

  • Christophe

    Member
    January 17, 2023 at 16:31
    324 Karma points
    Community rank: tentacle-noob-1 Tentacle noob
    Like it
    Up
    0
    Down
    Drop it
    ::

    Hello!

    The permissions on the python file to be executed are the same as yours. We tried to apply your advice but it still didn’t work. Increasing the global_alert_timeout didn’t help either. We then increased the verbosity as you advised. In the file ‘/var/log/pandora/pandora_server.log’ we have the result attached.

    I would like to point out that when we run the script by hand in the console with exactly the same parameters as those written in the screenshot (./kubapay_snmp_embv1.py -v “”‘13311354 , 9 , 69 , 3 , 10′” -o .1.3.6.1.4.1.57001.1.1.2.2.14) the operation succeeds and the agent is updated.

    Do you have the correspondence of the error we get (Command for action ‘launch SNMP script EMB’ alert ” agent ” returned with errorlevel 1)?

    Thanks in advance !

    Best regards

  • vic

    Administrator
    January 19, 2023 at 14:36
    1306 Karma points
    Community awards: bulb Bright ideas
    Community rank: tentacle_master_icon Tentacle Master
    Like it
    Up
    0
    Down
    Drop it
    ::

    Hi Christophe,

    Are all the commands in the script correct (as I see there are empty fields)?

    If any of them is not mail it is possible that the server cannot execute it correctly.

    Have you tried to put a redirect to a file at the end of the script to see if you get an error in the execution by the server?

    Best regards,

    Vic.

  • Christophe

    Member
    January 19, 2023 at 15:44
    324 Karma points
    Community rank: tentacle-noob-1 Tentacle noob
    Like it
    Up
    0
    Down
    Drop it
    ::

    Hi Vic,

    We have checked the commands. Here is a screenshot of one of them attached.

    The paths are correct and all outputs are redirected to a file but when we send an SNMP trap nothing is written to the file. even if we replace all the content of the script with a simple write to the file, nothing happens. However, in the page “SNMP alerts” of Pandora, the line corresponding to the SNMP alert associated with the trap received is marked as having been triggered.

    The server on which we have this error is a copy of another server on which we do not have this problem.

    Thanks in advance for your help,

    Best regards,