Azure Monitor Linux Process high CPU

Luke Uhren 206 Reputation points
2021-12-01T17:37:59.063+00:00

I am trying to find good examples or information if it's possible to use say Azure Monitor through log analytics to monitor high cpu on a specific process on Linux. I have seen good examples for windows with specific performance counters in Log Analytics, but nothing great for Linux. Is this possible for linux and if so how did you do it? I am wanting to say monitor omiagent for OMS if it takes up high amount of CPU to alert out. I have issues where it can take up a CPU core and I have to recycle the omiagent with sudo /opt/omi/bin/service_control restart.

Any help or information is greatly appreciated as I am having hard time finding good information for linux process monitoring for such things as high CPU usage

Thanks

Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
0 comments No comments
{count} votes

Answer accepted by question author
  1. Luke Uhren 206 Reputation points
    2021-12-01T22:19:44.443+00:00

    Seems you can't do this natively with Azure Monitor default metrics that I see. You can however, do this with telegraf via procstat plugin. https://github.com/influxdata/telegraf/blob/master/plugins/inputs/procstat/README.md .... I won't explain how to setup telegraf as there is already guides out there but if its setup properly and you do this, it'll be working.

    I configured it like so

    Monitor process cpu and memory usage

    [[inputs.procstat]]

    Must specify one of: pid_file, exe, or pattern

    PID file to monitor process

    pid_file = "/var/run/nginx.pid"

    executable name (ie, pgrep <exe>)

    exe = "nginx"

    pattern as argument for pgrep (ie, pgrep -f <pattern>)

    pattern = "nginx"

    exe = "grafana"

    Field name prefix

    prefix = "grafana"

    add name of process to monitor... such as below omiagent

    [[inputs.procstat]]
    exe = "omiagent"
    prefix = "omiagent"

    This now shows omi agent cpu_usage data for that process which I can now monitor and set alerts for specific thresholds

    154303-image.png

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.