I am new to Zabbix and feel like I am missing something basic. I want to monitor the CPU and memory usage for the top 10 processes. I want to graph and list the CPU usage with all of the processes on a single graph. I created a user parameter that uses a PowerShell script that calls a performance counter the returns the top 10 processes and their CPU usage in the JSON format. This works fine but I couldn't find any way to use this information directly in a graph. I did some investigation and it appears the only way I can do this is to use LLD to first retrieve the top 10 processes names and then use item prototypes to return the CPU usage for each of the processes. I have found posts in this forum and on the internet that show how this was done. However, I seem to be doing something wrong because the item prototype does not appear to work.
Name: CPU Per Process Name Discovery
Type: Zabbix agent
Key: CpuUsagePerProcess
Type of information: text
I also added a LLD Macro - LLD Macro: {#Name} JSON Path: $..Name
I am a little unclear about macros and not sure if this is setup correctly.
Below is the initial JSON data returned by using the PowerShell script. It contains the process names and their CPU usage.
[
{
"Name": "tracker-extract",
"CPUPercent": 99.74,
"Description": null
},
{
"Name": "pwsh",
"CPUPercent": 85.81,
"Description": null
},
{
"Name": "java",
"CPUPercent": 19.56,
"Description": null
},
{
"Name": "polkitd",
"CPUPercent": 11.35,
"Description": null
},
{
"Name": "accounts-daemon",
"CPUPercent": 7.51,
"Description": null
},
{
"Name": "setroubleshootd",
"CPUPercent": 6.48,
"Description": null
},
{
"Name": "dbus-daemon",
"CPUPercent": 4.8,
"Description": null
},
{
"Name": "chrome",
"CPUPercent": 1.95,
"Description": null
},
{
"Name": "gsd-account",
"CPUPercent": 1.65,
"Description": null
},
{
"Name": "gnome-shell",
"CPUPercent": 1.48,
"Description": null
}
]
The discovery rule appears to be working correctly because when I test it the results I get the data above.
For the Item Prototype I did the following.
Name: CPU Per Process Percentage
Type Zabbix agent
Key: proc.cpu.util[{#NAME}]
Type of Information: numeric (float)
When I test this it returns a 0 value. I expect I am missing something basic. What can I do to fix this issue?
Name: CPU Per Process Name Discovery
Type: Zabbix agent
Key: CpuUsagePerProcess
Type of information: text
I also added a LLD Macro - LLD Macro: {#Name} JSON Path: $..Name
I am a little unclear about macros and not sure if this is setup correctly.
Below is the initial JSON data returned by using the PowerShell script. It contains the process names and their CPU usage.
[
{
"Name": "tracker-extract",
"CPUPercent": 99.74,
"Description": null
},
{
"Name": "pwsh",
"CPUPercent": 85.81,
"Description": null
},
{
"Name": "java",
"CPUPercent": 19.56,
"Description": null
},
{
"Name": "polkitd",
"CPUPercent": 11.35,
"Description": null
},
{
"Name": "accounts-daemon",
"CPUPercent": 7.51,
"Description": null
},
{
"Name": "setroubleshootd",
"CPUPercent": 6.48,
"Description": null
},
{
"Name": "dbus-daemon",
"CPUPercent": 4.8,
"Description": null
},
{
"Name": "chrome",
"CPUPercent": 1.95,
"Description": null
},
{
"Name": "gsd-account",
"CPUPercent": 1.65,
"Description": null
},
{
"Name": "gnome-shell",
"CPUPercent": 1.48,
"Description": null
}
]
The discovery rule appears to be working correctly because when I test it the results I get the data above.
For the Item Prototype I did the following.
Name: CPU Per Process Percentage
Type Zabbix agent
Key: proc.cpu.util[{#NAME}]
Type of Information: numeric (float)
When I test this it returns a 0 value. I expect I am missing something basic. What can I do to fix this issue?
Comment