DX Application Performance Management

Expand all | Collapse all

EPAgent and PowerShell

Jump to Best Answer
  • 1.  EPAgent and PowerShell

    Posted 03-26-2015 12:18 PM

    Hi All,

     

    Are there any examples for using PowerShell with the epagent out there?



  • 2.  Re: EPAgent and PowerShell

    Posted 03-27-2015 02:23 AM
    We have usable examples with our Power Shell Agent FieldPack. I will post it tomorrow.


  • 3.  Re: EPAgent and PowerShell

    Posted 03-30-2015 01:44 PM

    I'd appreciate anything you have, thanks!



  • 4.  Re: EPAgent and PowerShell
    Best Answer

    Posted 03-30-2015 03:42 PM


  • 5.  Re: EPAgent and PowerShell

    Posted 04-01-2015 09:55 AM
      |   view attached

    Many thanks, Hiko!

     

    I was excited to see a Windows Event log script but it's not quite was I was looking for so I started writing my own. I'm getting tripped up on passing the metric up to our EM, however.

     

    What I'm looking to do is a quick and dirty scan the Windows application log for a specific event that may have occured in the last 5 minutes. This script gets me what I'm looking for but I'm getting the following error:

     

    Bad metric data from .\wineventlog.ps1 - Exceptioncalling "createIntCounterDataRecorder" with "1" argument(s): "Metric_Name_Is_Badly_Formed[WinEvents|Application Log|]"

        + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException

        + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,psEPA.ps1

     

    Attached is the script I'm running. Any thoughts?

    Attachment(s)

    zip
    wineventlog.ps1.zip   483B 1 version


  • 6.  Re: EPAgent and PowerShell

    Posted 04-01-2015 05:05 PM

    I'm looking into it now



  • 7.  Re: EPAgent and PowerShell

    Posted 04-01-2015 05:09 PM

    You cannot have a colon in the metric path. APM specifically uses that character as the metric name/value separator.

     

    Here is line 6 from your script:

     

    $metric = 'WinEvents|Application Log|Errors|:Event 1022=' + $msgCount

     

    Here is the same line from the example:

     

    $metric =  'WinEvents|Application Log|' + $enum + ':Message=' + $metricValue

     

    The issue lies with your metric name. It appears that you forgot to provide one before the colon.

    You can either remove the pipe symbol before the colon or provide a metric name there.

    I believe what you want to do is remove the pipe so you can this metric path, name, and value:

     

    $metric = 'WinEvents|Application Log|Errors:Event 1022=' + $msgCount


    so:


    domain|host|customprocess|agentname|WinEvents|Application Log|Errors:Event 1002 where 'Event 1002' is an IntCounter.



  • 8.  Re: EPAgent and PowerShell

    Posted 03-27-2015 07:29 AM


    Hi,

     

    we had good results with the following:

     

    In the IntroscopeEPAgent.properties:  

     

          [...].command=powershell -NoLogo -noninteractive -NoProfile -WindowStyle hidden -inputformat none -File "./epaplugins/path/myfile.ps1"

     

    In the Powershell Script at the beginning:

     

         $ErrorActionPreference = "SilentlyContinue"

         $bufferSize = new-object System.Management.Automation.Host.Size 256,30

         $Host.UI.RawUI.BufferSize = $bufferSize