HI
my nectar is working,but the reports send to email with wrong Graph links,my web's path like this :http://XXX:8080/cacti , but the path send to my email is http://xxx(or server name)/cacti. so where can i set the path?
how to set nectar's Graph links?
Moderators: Developers, Moderators
Re: how to set nectar's Graph links?
Try this patch.
This is for nectar-0.30.
(I imitated the code from 'thold/includes/settings.php'.)
And after patched, go 'Console' -> 'Settings' -> 'Misc' tab, then click 'save'.
(By this operation, 'nectar_base_url' record is added to 'settings' table) Note: $_SERVER['HTTP_HOST'] is only available when accessed via browser...
(not available from scheduled task)
This is for nectar-0.30.
(I imitated the code from 'thold/includes/settings.php'.)
Code: Select all
--- setup.php.org 2010-12-31 04:31:55.000000000 +0900
+++ setup.php 2011-03-02 19:27:34.194259000 +0900
@@ -477,6 +477,14 @@
"default" => NECTAR_TYPE_INLINE_PNG,
"array" => $attach_types
),
+ 'nectar_base_url' => array(
+ 'friendly_name' => 'Nectar Base URL',
+ 'description' => 'Cacti base URL for \'Graph linked\'',
+ 'method' => 'textbox',
+ // Set the default only if called from 'settings.php'
+ 'default' => ((isset($_SERVER['HTTP_HOST']) && isset($_SERVER['PHP_SELF']) && basename($_SERVER['PHP_SELF']) == 'settings.php') ? ('http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . '/') : ''),
+ 'max_length' => 255,
+ ),
"nectar_max_attach" => array(
"friendly_name" => "Maximum E-Mail Size",
"description" => "The maximum size of the E-Mail message including all attachements.",
Code: Select all
--- nectar_functions.php.org 2010-12-31 04:28:38.000000000 +0900
+++ nectar_functions.php 2011-03-02 19:30:51.508194000 +0900
@@ -669,6 +669,8 @@
}
if ($nectar["graph_linked"] == "on" ) {
+ $base_url = read_config_option("nectar_base_url");
+ if ($base_url == '') {
/* determine our hostname/servername in different environments */
if (isset($_SERVER["SERVER_NAME"])) {
$hostname = $_SERVER["SERVER_NAME"];
@@ -681,8 +683,10 @@
} else {
$hostname = "";
}
+ $base_url = "http://" . $hostname . $config['url_path'];
+ }
- $out = "<a href='http://" . $hostname . $config['url_path'] . "graph.php?action=view&local_graph_id=".$item['local_graph_id']."&rra_id=all'>" . $out . "</a>";
+ $out = "<a href='" . $base_url . "graph.php?action=view&local_graph_id=".$item['local_graph_id']."&rra_id=all'>" . $out . "</a>";
nectar_log(__FUNCTION__ . ", Link: " . $out, false, "NECTAR TRACE", POLLER_VERBOSITY_MEDIUM);
}
(By this operation, 'nectar_base_url' record is added to 'settings' table) Note: $_SERVER['HTTP_HOST'] is only available when accessed via browser...
(not available from scheduled task)
Re: how to set nectar's Graph links?
hi man! thanks!
Re: how to set nectar's Graph links?
I am using nectar 0.30 on 0.8.7g
While trying to apply both patches, I got errors from the patch utility:
I tried various patch options (e.g. -p1) with no luck. Similarly with the second patch.
Finally, I manually added the new lines (and deleted the one line marked with '-') and it just worked fine. The new option showed up in cacti > settings > MISC and the links in the reported graphs are OK.
It would be great to have this patch integrated into nectar for the next stable release.
While trying to apply both patches, I got errors from the patch utility:
Code: Select all
root@tor-cacti:/var/www/cacti/plugins/nectar# patch --verbose < patch1
Hmm... Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|--- setup.php.org 2010-12-31 04:31:55.000000000 +0900
|+++ setup.php 2011-03-02 19:27:34.194259000 +0900
--------------------------
Patching file setup.php using Plan A...
Hunk #1 FAILED at 477.
1 out of 1 hunk FAILED -- saving rejects to file setup.php.rej
done
Finally, I manually added the new lines (and deleted the one line marked with '-') and it just worked fine. The new option showed up in cacti > settings > MISC and the links in the reported graphs are OK.
It would be great to have this patch integrated into nectar for the next stable release.
Re: how to set nectar's Graph links?
Sorry, probably that error is caused by mismatch between the leading tab and spaces.
Add option "--ignore-white-space" when executing patch command,
or use this file instead.
Add option "--ignore-white-space" when executing patch command,
or use this file instead.
Re: how to set nectar's Graph links?
Hello 'Noname', thanks a lots for your patch! (It worked fine with Cacti 0.8.8a + Nectar v0.35a).
The only extra-thing I've done (by hand), was to adapt the lines from your patch, to Nectar v0.35a plus the other patch I've submitted to the forum:
http://forums.cacti.net/viewtopic.php?f ... 0&start=30
Note: I'm running Cacti v0.8.8a + Spine v0.8.8 + plugins (including Nectar v0.35a) on a FreeBSD 8.3p4 box at work.
Regards,
Pablo Carboni.
The only extra-thing I've done (by hand), was to adapt the lines from your patch, to Nectar v0.35a plus the other patch I've submitted to the forum:
http://forums.cacti.net/viewtopic.php?f ... 0&start=30
Note: I'm running Cacti v0.8.8a + Spine v0.8.8 + plugins (including Nectar v0.35a) on a FreeBSD 8.3p4 box at work.
Regards,
Pablo Carboni.
Re: how to set nectar's Graph links?
Sorry, but i dont understand what file is patched... nectar.php? setup.php???
Regards.
Regards.
Who is online
Users browsing this forum: No registered users and 2 guests