Ad Widget

Collapse

Parsing UsrParam item.value to create trigger

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rvandomp
    Junior Member
    • Jun 2014
    • 1

    #1

    Parsing UsrParam item.value to create trigger

    Hi,

    I am relatively new to Zabbix and using v 2.2.3. I have created a usr parameter that runs a script to detect the status of specific windows services and attempts to restart them. I want to have a trigger that will create an event if the item.value contains the string "not running" if there are X number of restart failures.

    The parameter pulls the services to be tested from a txt file that can be modified at the client level depending on requirements. This allows me to create a std key and triggers in the template.

    KEY: windows.service.autorestart[]

    Trigger:

    {$Z_CLIENT}.{$Z_ENV}.m_os Windows Automatic service {ITEM.VALUE} is not running

    {GIS-1T2W3X1-W7:windows.service.autorestart[].count(#5,"not running","like")}> 3

    The trigger that will create an event if the string not running is detected in 4 of the last 5 polls. We don't want a ticket if the service fails but then is restarted successfully.


    The output of the script is similar to this: (which becomes the item.value)

    service EventSystem is running
    service eventlog is running
    service lanmanserver is running service
    lanmanworkstation is running
    service PlugPlay is not running
    service RpcSs is running
    service seclogon is running
    service SNMP is currently disabled.
    service SENS is running
    service Winmgmt is running

    The problem is twofold:

    1. I want to be able to create an event based on one line of the item value and have that particular line as part of the event name (which gets forwarded to our ticketing system). Right now using the item.value in the name will return all of the output as part of the name. This same value will need to be in the clear event to automatically close the ticket
    2. If there happens to be two services not running I would like to have separate events created and track the count separately in order to have 2 different events

    I have not set the script to create a log file as I was hoping to avoid creating log files and creating a log monitor to create the event.

    I don't know if it is possible to extract part of the item value and use this or if it would be better to create a log file in the usr parameter and monitor that.

    We are not using remote commands in our configuration so I can't use the the service.state key with an action to trigger a service restart.

    Any help on this would be greatly appreciated.....Thanks
Working...