Ad Widget

Collapse

Host sub domain in action message

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • droflow
    Junior Member
    • Jul 2019
    • 2

    #1

    Host sub domain in action message

    If possible I would like to be able to have the hosts sub domain shown in the action message.

    All of our host names look something like "host1.sub.domain.net"

    I do have "Host: {HOST.NAME}" in my message which does give me the entire "host1.sub.domain.net", but I would also like to include the sub domain for better at a glance visibility.


    I tried creating a Global macro:

    {$HOST_ENV} => {{HOST.NAME}.iregsub("\.(.*?)\.", \1)}

    And then included this in the message, "Sub domain: {$HOST_ENV}"


    But it literally gave me "{{HOST.NAME}.iregsub("\.(.*?)\.", \1)}" in the message.
  • splitek
    Senior Member
    • Dec 2018
    • 101

    #2
    Global macro? And it looks like it will be macro in macro. This wont work. Try to use your expression inline.

    Comment

    • droflow
      Junior Member
      • Jul 2019
      • 2

      #3
      Since I'm pretty new to this. Would it looks something like this in the Action Message?

      {HOST.NAME}("\.(.*?)\.", \1)

      Comment

      • splitek
        Senior Member
        • Dec 2018
        • 101

        #4
        Examples at the end of page: https://www.zabbix.com/documentation...acro_functions
        But I checked this function in "Actions" and it dont work in that location.
        The only solution I see is:
        - in your hosts configuration set "Visible name" to name you want to see in messages
        - use {HOST.NAME} in Actions messages where you want to see you name
        - use {HOST.HOST} in Actions messages where you want to see you full name of the host with subdomain (value from "Host name" in host configuration)

        Comment

        Working...