Ad Widget

Collapse

Zabbix Triggers Not Fired

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Biju Raymond
    Junior Member
    • Mar 2024
    • 3

    #1

    Zabbix Triggers Not Fired

    Hi

    I have created a Trigger in Zabbix that is supposed to be fired if a host's CPU Usage is more than 90% for 5 continuous minutes.
    Here is the Trigger Expression:

    avg(/Chat1/system.run[powershell -ExecutionPolicy Bypass -File \\192.168.4.211\PS_Scripts\CPU_Usage.ps1],5m)>90

    And here is the CPU_Usage.ps1 script:

    try {
    # Attempt to fetch the total CPU usage percentage
    $cpuUsage = Get-WmiObject -Query "SELECT PercentProcessorTime FROM Win32_PerfFormattedData_PerfOS_Processor WHERE Name='_Total'" |
    Select-Object -ExpandProperty PercentProcessorTime

    # Check if the CPU usage was successfully retrieved
    if ($cpuUsage -ne $null) {
    # Output the CPU usage percentage with formatting for readability
    Write-Output $cpuUsage
    }
    else {
    Write-Output "Failed to retrieve CPU usage information."
    }
    } catch {
    # Handle errors gracefully
    Write-Output "An error occurred while trying to retrieve CPU usage information: $_"
    }


    I created a python script that could spike the CPU Usage to 100% (Verified in Task Manager's 'Performance' Tab as well).
    But though this python script spikes the CPU Usage to 100% for more than 5 minutes, The trigger is not being fired.
    I need help!
  • cyber
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2006
    • 4807

    #2
    And does it really return 100 as result for you for 5 minutes?

    Comment

    • Biju Raymond
      Junior Member
      • Mar 2024
      • 3

      #3
      Sometimes Yes, But I feel like this is not the right way to check for High CPU Usage. Kindly help me out!

      Comment

      • cyber
        Senior Member
        Zabbix Certified SpecialistZabbix Certified Professional
        • Dec 2006
        • 4807

        #4
        Why you check cpu through powershell script at all? Agent items are not enough? You can read those same perf counters also with agent, no need for any workarounds...

        Comment

        Working...