Ad Widget

Collapse

Zabbix 4.0 LLD Trigger prototype fire when value of Item is the same for 15 minutes

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mskieszabbix
    Junior Member
    • Jun 2019
    • 5

    #1

    Zabbix 4.0 LLD Trigger prototype fire when value of Item is the same for 15 minutes

    Hi,

    I am strugling with a LLD trigger inZabbix 4.0.
    I have a LLD item that gets the status of a sqlserver databases on servers.
    Normally the status of the database is Normal ( primary database) or Normal/Standby ( if it's a logshipping database).

    When the transaction logs are being apllied to the standby database it gets the status Restoring and when it's recovering the status Recovering.

    I have made a trigger that checks the status of the database.
    When it it does not have the status Normal or Normal/Standby it generates a problem in zabbix.
    This works fine.
    But I would like to incorporate the Restoring and Recovering status in the trigger.
    I want the trigger to generate a problem when the status of the database is Restoring or Recovering at least 15 minutes.

    I have tried using last and count functions but with no success.
    The trigger fires immediately after the status changes to Restoring, which is not what I want.

    trigger:

    {DBA_Template:system.run["powershell zbx_get_db_status.ps1 -HostName {#SQLSERVER.HOSTNAME} -Instance '{#SQLSERVER.INSTANCE}' -DBName '{#SQLSERVER.DBNAME}'"].iregexp({$STR_NORMAL},#1)}=0
    and
    {DBA_Template:system.run["powershell zbx_get_db_status.ps1 -HostName {#SQLSERVER.HOSTNAME} -Instance '{#SQLSERVER.INSTANCE}' -DBName '{#SQLSERVER.DBNAME}'"].strlen(#1,0s)}<>0
    and
    {DBA_Template:system.run["powershell zbx_get_db_status.ps1 -HostName {#SQLSERVER.HOSTNAME} -Instance '{#SQLSERVER.INSTANCE}' -DBName '{#SQLSERVER.DBNAME}'"].iregexp({$STR_TIMEOUT},#1)}=0
    and
    {DBA_Template:system.run["powershell zbx_get_db_status.ps1 -HostName {#SQLSERVER.HOSTNAME} -Instance '{#SQLSERVER.INSTANCE}' -DBName '{#SQLSERVER.DBNAME}'"].iregexp({$STR_UNKNOWN},#1)}=0
    and
    ({DBA_Template:system.run["powershell zbx_get_db_status.ps1 -HostName {#SQLSERVER.HOSTNAME} -Instance '{#SQLSERVER.INSTANCE}' -DBName '{#SQLSERVER.DBNAME}'"].count(#2,{$STR_RESTORING},like,10m)}>3
    or {DBA_Template:system.run["powershell zbx_get_db_status.ps1 -HostName {#SQLSERVER.HOSTNAME} -Instance '{#SQLSERVER.INSTANCE}' -DBName '{#SQLSERVER.DBNAME}'"].count(#2,{$STR_RECOVERING},like,10m)}>3)
    Is there another way?

    Thanks in advance.
Working...