Back to Opsview FAQ

Internal documentation only

This page has been marked as draft.

Infrastructure Agent - Windows Agent - PowerShell scripts

The Infrastructure Agent can be customised by adding your own plugins. These plugins can be written in any language supported by your OS.

To add in your own PowerShell based custom plugin into the Windows Infrastructure (Beta) agent, follow these steps

Prereqs Copied

Assumptions Copied

Steps Copied

On the Windows server Copied

  1. Place your PowerShell script in the directory C:\Program Files\Infrastructure Agent\plugins\imported\

  2. Ensure the script works correctly on the server using the PowerShell IDE or Command shell prompt

  3. Create or amend C:\Program Files\Infrastructure Agent\cfg\custom\agent.yml and add in the following code either at the bottom of the file or added into the existing “commands” section:

    commands:
      check_my_psscript:
        path: PowerShell.exe -NoProfile -NonInteractive -ExecutionPolicy Bypass -File C:/Program\ Files/Infrastructure\ Agent/plugins/imported/check_my_psscript.ps1 $ARG1$
    

    Note: you only need to specify$ARG1$, regardless how many options the plugin uses

  4. Restart the Infrastructure Agent using the Services application tool

In the Opsview UI Copied

  1. Go to Menu bar => Configuration => Service Checks, locate the Windows - Drive check, click on the contextual menu button and select Clone
  2. On the Service Checks tab, amend the Name to be My PS Script and set an appropriate Description
  3. On the Plugin and Arguments tab, amend the Arguments field as follows, ensuring any quoting around options are preserved:
    1. Change the -c option from nsc_checkdrivesize to check_my_psscript (to match the agent.yml configuration)
    2. Change the -a option from Drive=%WINDOWS_DRIVE%: %WINDOWS_DRIVE:1% to the arguments required for your script
  4. Go to Menu bar => Configuration => Hosts => MyWinSvr, on the Service Checks tab, expand OS => Windows Base and select the My PS Script Servicecheck created in step 3.
  5. Run an “Apply Changes”

Further Information Copied

Documentation for Infrastructure Agent is available here

["Geneos"] ["FAQ"]

Was this topic helpful?