Welcome to Pandora FMS Community!

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

Bienvenido a la comunidad de Pandora FMS Forums Community support Register Server Plugin without a file?

  • Register Server Plugin without a file?

    Posted by aeleus on mayo 24, 2024 at 16:56

    I am trying to register a simple plugin that runs a command and does not include a script file. The following plugin_definition.ini works, but it includes the file (test.pl) and the plugin command looks like this:

    my command /var/www/html/pandora_console/attachment/plugin/test.pl

    [plugin_definition]

    name = Test Plugin

    description = “A test plugin”

    timeout = 20

    filename = test.pl

    execution_command = my command

    execution_postcommand =

    parameters = -a _field1_

    plugin_type = 0

    total_modules_provided = 0

    total_macros_provided = 1

    [macro_1]

    hide = 0

    description = “Agent name (obligatory)”

    help = “The name of the agent for the modules discovered”

    value =

    I would like to be able to eliminate the test.pl file and have the command be simply “my command”.

    If “filename=” or is omitted, the plugin fails to register.

    Version v7.0NG.776 – Community
    Rocky Linux 8.9

    aeleus replied 5 months, 3 weeks ago 2 Members · 5 Replies
  • 5 Replies
  • vic

    Administrator
    mayo 24, 2024 at 17:49
    1533 Karma points
    Community awards: bulb Bright ideas
    Community rank: tentacle_master_icon Tentacle Master
    Like it
    Up
    0
    Down
    Drop it
    ::

    Hi aeleus.

    Yes, you can configure the plugin directly in the command field using as many macros as you need “_fieldX_”.

    You will need to create as many macros as the plugin needs as customisable parameters.

    Best regards,
    Víc.

    • aeleus

      Member
      mayo 24, 2024 at 20:11
      529 Karma points
      Community rank: tentacle-rookie Tentacle rookie
      Like it
      Up
      0
      Down
      Drop it
      ::

      Thank you for the response, Vic.

      I understand that I can do as you show using the UI. I have about 50 plugins to create. That would mean individually creating and editing each plugin. I would like to make this as automated and repeatable as possible.

      Based on your screenshot, this is how the plugin_definition.ini might look:

      [plugin_definition]

      name = Test Plugin

      description = “A test plugin”

      timeout = 20

      filename =

      execution_command = echo

      execution_postcommand =

      parameters = _field1_ _field2_

      plugin_type = 0

      total_modules_provided = 0

      total_macros_provided = 2

      [macro_1]

      hide = 0

      description = “Field 1”

      help = “Field1: Type String”

      value = “This is a plugin”

      [macro_2]

      hide = 0

      description = “Field 2”

      help = “”

      value = “executed by the Pandora FMS server.”

      When zipped into a pspz2 file, this plugin fails to register and be created. Am I doing something wrong?

  • vic

    Administrator
    mayo 27, 2024 at 10:39
    1533 Karma points
    Community awards: bulb Bright ideas
    Community rank: tentacle_master_icon Tentacle Master
    Like it
    Up
    0
    Down
    Drop it
    ::

    Hi aeleus,

    I noticed that you have not attached a file in “filename”, can you add one?

    Best regards,
    Víc.

  • vic

    Administrator
    mayo 27, 2024 at 10:39
    1533 Karma points
    Community awards: bulb Bright ideas
    Community rank: tentacle_master_icon Tentacle Master
    Like it
    Up
    1
    Down
    Drop it
    ::

    Hi aeleus,

    I noticed that you have not attached a file in “filename”, can you add one?

    Best regards,
    Víc.

    • aeleus

      Member
      mayo 30, 2024 at 02:15
      529 Karma points
      Community rank: tentacle-rookie Tentacle rookie
      Like it
      Up
      0
      Down
      Drop it
      ::

      Yes, I have tried it with an attached file. That is the result I show at the beginning of this thread. As you can see, it places the file here: /var/www/html/pandora_console/attachment/plugin/test.pl

      It also creates a command that looks like this:

      my command /var/www/html/pandora_console/attachment/plugin/test.pl
      Not what I expect or want.

      Thanks for the replies, but I’ve solved my problem (more or less) by using a combination of the CLI and DB calls to fill in the gaps where the CLI falls short – that is for a different discussion.