Ad Widget

Collapse

Run shell command into trigger

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • denizguzel
    Junior Member
    • Oct 2017
    • 2

    #1

    Run shell command into trigger

    Hi I want to run shell command into zabbix trigger. Can I do it? Can you help me? want ro running scrpt follow as;
    curl --data 'os_username=jirauser&os_password=pass' https://jira.company.com.tr | grep -c 'value="jirauser"'

    I use reslt of command in zabbix trigger.
    Last edited by denizguzel; 12-10-2017, 12:32.
  • kaspars.mednis
    Senior Member
    Zabbix Certified Trainer
    Zabbix Certified SpecialistZabbix Certified Professional
    • Oct 2017
    • 349

    #2
    Hello !

    I think you may use user parameters


    best regards,
    Kaspars

    Comment

    • allexpetrov
      Senior Member
      Zabbix Certified Trainer
      Zabbix Certified SpecialistZabbix Certified Professional
      • May 2017
      • 361

      #3
      Hello,

      Could you please be more specific on what you're trying to achieve ? What kind of value you script returns? Is it a string value or numeric value?

      How long it takes to perform this script ? Maybe it is better to have a Zabbix Trapper item and perform it via cronjob?

      More about Zabbix Trapper: https://www.zabbix.com/documentation...mtypes/trapper

      Regards,
      Alex!

      Comment

      • denizguzel
        Junior Member
        • Oct 2017
        • 2

        #4
        Thank you for your return.

        Bash command: curl --data 'os_username=jirauser&os_password=pass' https://jira.company.com.tr | grep -c 'value="jirauser"'

        This command is returning 1 or 0 value. I want to monitor the result of the command. Also I want to alerted with e-mail.

        Best regards...

        Comment

        • tutunak
          Member
          • Mar 2016
          • 32

          #5
          You can do that with external scripts or system.run items. After creating the item you need configure Trigger for item value 1 or 0. For send email, you need to configure the action.

          Comment

          • allexpetrov
            Senior Member
            Zabbix Certified Trainer
            Zabbix Certified SpecialistZabbix Certified Professional
            • May 2017
            • 361

            #6
            Then just run the script from system.run[] or using cronjob with zabbix_sender. Please note that there is a Timeout parameter.

            You can use UserParameters as well: https://www.zabbix.com/documentation...userparameters and https://www.zabbix.com/documentation...xtending_agent

            Then create a trigger with .last value function if you need to trigger for the LAST value. Trigger functions: https://www.zabbix.com/documentation...gers/functions

            Regards,
            Alex!

            Comment

            Working...