OpenNetAdmin

Track. Automate. Configure.

Home About Features Community Develop
Download this project as a tar.gz file

host_actions.config.php

druwoldt

16-08-2011 23:12:49

Dear Mat,

In the host_actions.config.php I can set
$conf[$modulename]['Nagios']['url'] = "https://localhost/nagios/cgi-bin/status.cgi?host=%fqdn&style=detail";

Which then gives a link for host serverX.edu.au as
https://localhost/nagios/cgi-bin/status ... yle=detail"

What I need to do is be able to just insert the hostname. So something like
https://localhost/nagios/cgi-bin/status.cgi?host=%hostname&style=detail"

to give

https://localhost/nagios/cgi-bin/status ... yle=detail"

Is this possible?

Yours sincerely

David Ruwoldt

Matt

24-08-2011 11:38:39

There is not currently a way to do this. Its a great idea so here is how you can enable it. Add the following to line 40 in /opt/ona/www/workspace_plugins/builtin/host_actions/main.inc.php


$nameparts = explode('.',$record['fqdn'],2);
$hval['url'] = str_replace('%hostname', $nameparts[0], $hval['url']);
$hval['url'] = str_replace('%onahostname', $record['name'], $hval['url']);
$hval['url'] = str_replace('%domain', $nameparts[1], $hval['url']);
$hval['url'] = str_replace('%onadomain', $record['domain_fqdn'], $hval['url']);

I've also added an onahostname and onadomain.. this relates to the possibility of having a host in ONA that is split on a different octet boundary such as server1.loc example.com vs. server1 loc.example.com. It all depends on how you are storing the data in ONA.

I'll add this into the main code.

druwoldt

07-09-2011 18:07:49

Dear Mat,

That worked a treat. Thankyou.

Yours sincerely

David Ruwoldt