Ad Widget

Collapse

Using a macro in the URL of a trigger

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nate015
    Junior Member
    • Jun 2009
    • 6

    #1

    Using a macro in the URL of a trigger

    I would like to use macros in the URL of a trigger so that I can automatically splunk an issue.

    For example something like:

    https://XXX.XXX.XXX.XXX:8000/?q=host%3D{HOSTNAME}2%20starthoursago%3D24&selStar t=false&selEnd=false

    where it would replace {HOSTNAME} with the hostname from the trigger. Of course, if we could pass any macro in we could do some really powerful stuff with zabbix and splunk. I can't find this functionality in the manual or on the forums, is it already possible some other way? If not can it be considered for a future release?
    Last edited by nate015; 08-07-2009, 15:42.
  • nate015
    Junior Member
    • Jun 2009
    • 6

    #2
    Bump.


    Zabbix is great.

    Comment

    • nate015
      Junior Member
      • Jun 2009
      • 6

      #3
      Does no one else think this would be a great feature?

      Comment

      • Kai-Kai
        Senior Member
        • Apr 2009
        • 142

        #4
        Yes. I do think it could be really interesting.
        But I don't know any way to do that... that's why I didn't answer this topic before.

        Comment

        • nate015
          Junior Member
          • Jun 2009
          • 6

          #5
          Somehow the "Name" field in the triggers transforms the macros, I would assume the URL field could be designed similarly?

          Comment

          • Kai-Kai
            Senior Member
            • Apr 2009
            • 142

            #6
            I think it's not currently implemented.
            But it can be a great idea for the next version...

            Comment

            • nate015
              Junior Member
              • Jun 2009
              • 6

              #7
              I tried to modify triggers.php to no avail. I will have to leave it to one of the zabbix pro developers.

              Thanks for making me not feel alone fcge.

              Comment

              • Kai-Kai
                Senior Member
                • Apr 2009
                • 142

                #8
                It was a real pleasure.

                Comment

                • danrog
                  Senior Member
                  • Sep 2009
                  • 164

                  #9
                  Just in case someone wants to add this to 1.8.1 release:

                  Here is a quick patch. I've only added {HOSTNAME} and {HOST.DNS} as vaild options here, but its pretty simple to add more items. You just have to figure out the trigger array format.
                  Code:
                  --- /home/zabbix/software/zabbix-1.8.1/frontends/php/tr_status.php	2010-01-27 16:22:45.000000000 -0500
                  +++ /var/www/html/zabbix/tr_status.php	2010-01-29 12:26:16.000000000 -0500
                  @@ -471,7 +471,14 @@
                   		}
                   		$menu_trigger_url = 'null';
                   		if(!zbx_empty($trigger['url'])){
                  -			$menu_trigger_url = "['".S_URL."',\"javascript: window.location.href='".$trigger['url']."'\",
                  +			$turl = $trigger['url'];
                  +			if(zbx_strstr($turl, '{HOSTNAME}')){
                  +            	       		 $turl = str_replace('{HOSTNAME}', $trigger['hosts'][0]['host'], $turl);
                  +                        }
                  +                        if(zbx_strstr($turl, '{HOST.DNS}')){
                  +                                 $turl = str_replace('{HOST.DNS}', $trigger['dns'], $turl);
                  +                        }
                  +			$menu_trigger_url = "['".S_URL."',\"javascript: window.location.href='".$turl."'\",
                   				null, {'outer' : ['pum_o_item'],'inner' : ['pum_i_item']}]";
                   		}

                  Comment

                  • richlv
                    Senior Member
                    Zabbix Certified Trainer
                    Zabbix Certified SpecialistZabbix Certified Professional
                    • Oct 2005
                    • 3112

                    #10
                    resurrecting an old thread, but if you were interested, you should follow this issue : https://support.zabbix.com/browse/ZBXNEXT-1128
                    Zabbix 3.0 Network Monitoring book

                    Comment

                    Working...