Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

Custom MACRO not interpreted in URL #5846

Closed
Hellnino18 opened this issue Oct 31, 2017 · 5 comments
Closed

Custom MACRO not interpreted in URL #5846

Hellnino18 opened this issue Oct 31, 2017 · 5 comments

Comments

@Hellnino18
Copy link

Hi,

Since we are in Centreon 2.8.13, (from 2.6), the custom MACRO ($_HOSTMYMACRO$) are not interpreted in "Host Extended Infos" => URL. This is a link to our wiki, and I get that :

https://myurl.domain.tld/index.php/$_HOSTMYMACRO$#Goodhostname

In host configuration, this is what I declared : https://myurl.domain.tld/index.php/$_HOSTMYMACRO$#$HOSTNAME$

with HOSTMYMACRO : text_12_34

In Centreon 2.6 this works.

Thanks for your help (same problem in template or directly in host configuration).

@lpinsivy lpinsivy added the status/more-info-needed Waiting for more information label Oct 31, 2017
@lpinsivy
Copy link
Contributor

Hi,

I try with Centreon web 2.8.15 and custom macro are interpreted.

Did you generate and export configuration then restart poller?

@Hellnino18
Copy link
Author

Hi Laurent,

It works in Monitoring > Status Details > Services page, but in Monitoring > Status details > Hosts, it doesn't work. My custom MACRO isn't replaced and in my URL I have %24MYCUSTOMMACRO%24

And yes I have generated, exported then restart my poller.

@lpinsivy
Copy link
Contributor

lpinsivy commented Nov 2, 2017

@Hellnino18 can you try this patch on www/include/monitoring/status/Hosts/xml/hostXML.php:

@@ -375,7 +375,7 @@
         $str = str_replace("\$HOSTSTATE\$", $obj->statusHost[$data['state']], $str);

         $str = str_replace("\$INSTANCEADDRESS\$", $instanceObj->getParam($data['instance_name'], 'ns_ip_address'), $str);
-        $obj->XML->writeElement("hnu", CentreonUtils::escapeSecure($hostObj->replaceMacroInString($data["notes_url"], $str)));
+        $obj->XML->writeElement("hnu", CentreonUtils::escapeSecure($hostObj->replaceMacroInString($data["name"], $str)));
     } else {
         $obj->XML->writeElement("hnu", "none");
     }

@Hellnino18
Copy link
Author

@lpinsivy thx it works 👍

@adr-mo
Copy link
Contributor

adr-mo commented Nov 7, 2017

OK everything looks good to me.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants