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 Advanced troubleshooting Pandora Agent WMI query using non-standard namespace

  • Pandora Agent WMI query using non-standard namespace

    Posted by FMSer on noviembre 17, 2010 at 20:55

    I would like to add a module to my LDAP server to get some AD information.  As an example, I can run the following WMIC query to get an email address from the Pandora server:

    wmic –namespace=”rootdirectoryLDAP” -U “DOMAINuser”%MyPassword //AD-DC1 “Select ds_mail From ds_user WHERE ds_samaccountname=’userID'”

    I have obviously removed the sensitive info, but can a pandora_agent.conf file use this different namespace, or any other non ROOTCIMv2 namespace?

    Thanks.

    raul replied 14 years, 2 months ago 2 Members · 1 Reply
  • 1 Reply
  • raul

    Member
    noviembre 29, 2010 at 19:12
    0 Karma points
    Community rank: tentacle-noob-1 Tentacle noob
    Like it
    Up
    0
    Down
    Drop it
    ::

    You can create a vbs file like this (check syntax and options, but the idea is this):

    Set objWMI = GetObject("winmgmts:rootdirectoryLDAP")

    Set colObjets = objWMI.ExecQuery _
    (-U "DOMAINuser"%MyPassword //AD-DC1 "Select ds_mail From ds_user WHERE ds_samaccountname='userID'")

    For Each objObjet in colObjets
    WScript.Echo (objObjet.ds_mail)
    Next

    Save it like mail.vbs and test if it works (gives your desired output) with

    cscript //Nologo mail.vbs

    Then, add an exec module like:

    module_begin
    module_name Mail
    module_type generic_data_string
    module_exec cscript //Nologo mail.vbs
    module_description Mail
    module_end

    Of course, change at will.

    cscript //Nologo mail.vbs