Forum Discussion

RajeshP's avatar
4 years ago

Output representation for each process name in Logicmonitor

I am running a powershell script to get the CPU utilization of each process and it is showing when running test script as attached to this question.

To store it in device it is showing as percentage of CPU and not application name. How to store as application name ?

Can someone help on how to save each application CPU utilization in Logicmonitor as every time some application may be having utilization and some may not ?

  • Anonymous's avatar
    Anonymous

    Just to check some basics: this is a multi-instance, BATCHSCRIPT DS and you have active discovery enabled. Right?

    It looks like you put your collection script into the active discovery script section. Your ActiveDiscovery script should be outputting the ID and name of the application in this format:

    app1_id##app1_displayname
    app2_id##app2_displayname
    app3_id##app3_displayname
    app4_id##app4_displayname
    app5_id##app5_displayname

     

  • >>>>>>> Just to check some basics: this is a multi-instance, BATCHSCRIPT DS and you have active discovery enabled. Right?

    Yes, Correct multi-instance and active discovery enabled.

    >>>>>>>>> It looks like you put your collection script into the active discovery script section. Your ActiveDiscovery script should be outputting the ID and name of the application in this format:

    It is in below format:

    Application_Name1##CPU_Percentage
    Application_Name2##CPU_Percentage

  • Anonymous's avatar
    Anonymous

    That's not the right format. Your discovery script output should be like this:

    app1_id##app1_displayname
    app2_id##app2_displayname
    app3_id##app3_displayname
    app4_id##app4_displayname
    app5_id##app5_displayname

     

  • In this setup for multi-instance, active discovery method, there are 2 blocks for adding Powershell script.

    1st block after Active discover option parameters and 2nd block after Collector attributes.

    What should be placed in the collector attributes script block ?

  • Anonymous's avatar
    Anonymous

    In the active discovery script, you should put the script that fetches the list of things to be monitored (instances to create in LM).

    In the collector attributes script, you should put the script that fetches the actual data. What you were using for your active discovery script would likely be very close to what you actually need for your collection script.

  • Can you please provide any example of the Collector attributes script as reference for better understanding ?

  • Anonymous's avatar
    Anonymous

    Sure, but you already have the collector script, mostly.

    The question you need to answer is whether you setup the DS as script or batchscript.

  • Anonymous's avatar
    Anonymous

    If you set it up as script, then your script should only output the data for one of the instances (app/service/process). In that case, the output should look like this according to the support documentation:

    datapoint_name: value

    So, in your case, it would look like this:

    cpu: 87

     

    However, if you chose batchscript (which you likely should change if you didn't), then our output should look like this:

    instance1.key1: value1
    instance1.key2: value2
    instance1.key3: value3
    instance2.key1: value1
    instance2.key2: value2
    instance2.key3: value3

    So, in your case it would look like this:

    sihost.cpu: 23
    ssonsvr.cpu: 8
    ShellExperienceHost.cpu: 20
    SelfService.cpu: 9
    SelfServicePlugin.cpu: 15

     

  • My collector script prints the data like below

    Application_Name1##CPU_Percentage
    Application_Name2##CPU_Percentage

     

    So what should I place in collector attributes script to store data ?

  • Anonymous's avatar
    Anonymous

    Looks like batchscript then (look at the options in the "general information" section of the DS config to be sure). In that case, use the 3rd and 4th output snippets from my previous reply as your template.