I need to add a custom link for my hosts in Zabbix trigger popupmenu. Zabbix has a section in Dashboard for show triggers and when we click on each Hostname, a popup menu opened and there is some default links.
Now i need to add a link for hosts that when we click on it, open a new page for control Panel or every related page.
There is some solution but all of them was for older versions:
https://support.zabbix.com/browse/ZBXNEXT-3496
https://github.com/v-zhuravlev/zabbix-hostmenu
There is two file that i can modify and add new custom link to popupmenu or add a new column with new link.
1- /usr/share/zabbix/js/menupopup.js
2- /usr/share/zabbix/app/views/monitoring.widget.problems.view.php
For now The link added successfully from 2 ways but i need to use Macro (Hostname, Hostip , ...) in the link url.
File: menupopup.js
// go to section
if (options.hasGoTo) {
// inventory
var
//My Custom Link
rd_data = { label: t('Remote Link')},
rd_qurl = 'http://remote.mydomain.com/Host#Access/Connected Systems/'+{HOST.NAME},
rd_data_url = new Curl(rd_qurl, false),
// host inventory
host_inventory = {
label: t('Host inventory')
},
host_inventory_url = new Curl('hostinventories.php', false),
// latest
latest_data = {
label: t('Latest data')
},
latest_data_url = new Curl('latest.php', false),
// problems
problems = {
label: t('Problems')
},
// graphs
graphs = {
label: t('Graphs')
},
// screens
screens = {
label: t('Host screens')
};
//My Custom Link
rd_data.url = rd_data_url.getUrl();
// inventory link
host_inventory_url.setArgument('hostid', options.hostid);
host_inventory.url = host_inventory_url.getUrl();
// latest data link
if (typeof options.filter_application !== 'undefined') {
latest_data_url.setArgument('application', options.filter_application);
}
latest_data_url.setArgument('hostids[]', options.hostid);
latest_data_url.setArgument('filter_set', '1');
latest_data.url = latest_data_url.getUrl();
if (!options.showTriggers) {
problems.disabled = true;
}
else {
var url = new Curl('zabbix.php', false);
url.setArgument('action', 'problem.view');
url.setArgument('filter_hostids[]', options.hostid);
if (typeof options.severity_min !== 'undefined') {
url.setArgument('filter_severity', options.severity_min);
}
if (typeof options.show_suppressed !== 'undefined' && options.show_suppressed) {
url.setArgument('filter_show_suppressed', '1');
}
if (typeof options.filter_application !== 'undefined') {
url.setArgument('filter_application', options.filter_application);
}
url.setArgument('filter_set', '1');
problems.url = url.getUrl();
}
if (!options.showGraphs) {
graphs.disabled = true;
}
else {
var graphs_url = new Curl('charts.php', false);
graphs_url.setArgument('hostid', options.hostid);
graphs.url = graphs_url.getUrl();
}
if (!options.showScreens) {
screens.disabled = true;
}
else {
var screens_url = new Curl('host_screen.php', false);
screens_url.setArgument('hostid', options.hostid);
screens.url = screens_url.getUrl();
}
sections.push({
label: t('Go to'),
items: [
rd_data,
host_inventory,
latest_data,
problems,
graphs,
screens
]
});
}
You can see my modify section with name "//My custom link".
Anyway i need to use Marco "{HOST.NAME}" at the end of my url.
How can i add this Marco on this code ?
Regards,