Ad Widget

Collapse

Can I create multiple macros in a same host?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • LuisTemporal
    Junior Member
    • Nov 2021
    • 14

    #1

    Can I create multiple macros in a same host?

    Hi, I have a host with several websites running, I have followed the following tutorial to monitor a website:

    Learn step-by-step how to create Zabbix Website scenarios with examples and how to simplify the process of web monitoring!


    But when I add another macro to add a different URL, it tells me that the macro already exists, even though I am giving it a different value.
    Click image for larger version

Name:	macros.png
Views:	686
Size:	63.6 KB
ID:	444084

    Is it possible to add multiple URLs in the same macro or can I add a separate macro for each URL? Thank you...
  • jtnfoley
    Member
    • Mar 2022
    • 76

    #2
    Don't use a macro at all (use a static URL in each monitored item) or, if the URLs are used elsewhere and are expected to change, create a custom macro for each in Administration/General/Macros (eg "{$MYWEB.URL30002" = http://blankedurl:30002}", "{$MYWEB.URL30003" = http://blankedurl:30003}" etc. ) and use these in your monitored items.

    Comment

    • cyber
      Senior Member
      Zabbix Certified SpecialistZabbix Certified Professional
      • Dec 2006
      • 4811

      #3
      If you think a little bit, then you probably reach the same conclusion, that you cannot have 2 macros with same name for very obvious reasons... How would system know, which one to use...
      I would create a host per website and just have one webscenario on each. Then you can template it, use that WEB.URL macro if you want (use it in template and define value in host level). Or if those URL-s somehow relate to hostname, just use HOST.NAME macro... If you insist on using just one host... then you just need to hardcode them as already suggested. Using general macros is pretty .. hmm.. interesting suggestion.. Result is same as just hardcoding them... So why bother at all... They are irrelevant any other monitoring, why show them to all of your hosts...

      Comment

      Working...