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 Report / SQL element / Date of selection

  • Report / SQL element / Date of selection

    Posted by Christophe on July 27, 2022 at 10:10

    Hello,

    I’ve created a report using a SQL element. I want to know how I can integrate the “date filter” in the Report view in this request ?

    Is-there a special Tag to put in the SQL request to be able to use the date filter ?

    In the following request, I want to change the line starting by “and FROM_UNIXTIME…” to use a “BETWEEN” using the filter dates.

    eg :

    select a.alias agent_name, FROM_UNIXTIME(min(c.utimestamp)) DateMin_Compil,FROM_UNIXTIME(max(c.utimestamp)) DateMax_Compil, count(*) occurence

    from tagente_datos c, tagente_modulo b, tagente a

    where

    b.id_agente_modulo = c.id_agente_modulo

    and a.id_agente = b.id_agente

    and (b.nombre like “Resultat compil%”)

    and a.nombre like “Compil.%”

    and FROM_UNIXTIME(c.utimestamp) >= DATE_SUB(CURRENT_DATE(),INTERVAL 7 DAY)

    and datos <> 2

    group by c.id_agente_modulo, b.nombre,a.alias

    order by occurence desc, alias;

    Sergio replied 2 weeks, 5 days ago 2 Members · 1 Reply
  • 1 Reply
  • Sergio

    Administrator
    July 27, 2022 at 11:23
    105 Karma points
    Community rank: Tentacle noob
    Like it
    Up
    0
    Down
    Drop it
    ::

    Hi,

    The only thing we have restricted in Reports is the use of the asterisk (*).

    From there you can actually execute any MySQL query you want as long as its syntaxis is correct.

    You can use the DB Interface in the console at the “Admin Tools” section where you can try the query and see if it executes and gives you the result needed.

    Then you can simply configure that query in your MySQL report and get the results needed.

    Kind regards,

    Sergio B.