Nectar and graph linked

General discussion about Plugins for Cacti

Moderators: Developers, Moderators

Post Reply
zivley
Cacti User
Posts: 69
Joined: Tue Nov 13, 2007 6:22 am

Nectar and graph linked

Post by zivley »

Hi,
I have a problem I want to report.
When selecting the option "Graph Linked" on nectar report, I receive the mails with the graph linked to http://cacti/graph.php?.....
I can't figure out where is the plugin trying to take the hostname from as is obviously failing, thus leaving this empty.
I'd like this field to have an option in settings so you can define a manual entry, in addition to the script to try to define it automatically.
When you have a FQDN it makes sense to detect and set the hostname to it, but what if I want to point the graphs to a specific hostname or ip address?

For now, I'd like to know if I can temporarily solve it by manually setting this to what I want on the nectar_functions.php file
Could I just change this:

Code: Select all

        if ($nectar["graph_linked"] == "on" ) {
                /* determine our hostname/servername in different environments */
                if (isset($_SERVER["SERVER_NAME"])) {
                        $hostname = $_SERVER["SERVER_NAME"];
                } elseif (isset($_SERVER["HOSTNAME"])) {
                        $hostname = $_SERVER["HOSTNAME"];
                } elseif (isset($_ENV["HOSTNAME"])) {
                        $hostname = $_ENV["HOSTNAME"];
                } elseif (isset($_ENV["COMPUTERNAME"])) {
                        $hostname = $_ENV["COMPUTERNAME"];
                } else {
                        $hostname = "";
                }
Into something like this?

Code: Select all

        if ($nectar["graph_linked"] == "on" ) {
                $hostname = "10.3.4.15"; 
                }
Do you think of a better workaround until this could be made configurable on the GUI?
Thanks!
Ziv
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: Nectar and graph linked

Post by gandalf »

That looks reasonable. But I'd like to know why the other options do not work ...
R.
zivley
Cacti User
Posts: 69
Joined: Tue Nov 13, 2007 6:22 am

Re: Nectar and graph linked

Post by zivley »

gandalf wrote:That looks reasonable. But I'd like to know why the other options do not work ...
R.
I don't really know why, the hostname has no FQDN set up, only a local alias, which in any case is not what I need
Perhaps you could use the last "else" as a last resort, and use the host ip rather than leaving it blank. I think it should never be left empty anyway.
Something like this:

Code: Select all

if ($nectar["graph_linked"] == "on" ) {
                /* determine our hostname/servername in different environments */
                if (isset($_SERVER["SERVER_NAME"])) {
                        $hostname = $_SERVER["SERVER_NAME"];
                } elseif (isset($_SERVER["HOSTNAME"])) {
                        $hostname = $_SERVER["HOSTNAME"];
                } elseif (isset($_ENV["HOSTNAME"])) {
                        $hostname = $_ENV["HOSTNAME"];
                } elseif (isset($_ENV["COMPUTERNAME"])) {
                        $hostname = $_ENV["COMPUTERNAME"];
                } else {
                        $hostname = $_SERVER["SERVER_ADDR"];
                }
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: Nectar and graph linked

Post by gandalf »

Sounds good; will investigate
R.
mitchese
Posts: 8
Joined: Fri Jan 25, 2013 4:52 am

Re: Nectar and graph linked

Post by mitchese »

For anyone who finds this thread via google...here's another thread with the same issue, including a patch that resolves this:

http://forums.cacti.net/viewtopic.php?f=21&t=41968
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests