Skip to content

Commit

Permalink
Ability to set vanity URL for graphite, which is used when sending al…
Browse files Browse the repository at this point in the history
…erts
  • Loading branch information
alexforrow committed Oct 24, 2012
1 parent 6b39934 commit 3de6296
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion GraphiteZenossBridge.class.php
Expand Up @@ -86,6 +86,12 @@ function __construct($CredentialsBundle, $QueryBundle)
$this->ZenossURL = $CredentialsBundle['zenoss_url'];
$this->GraphiteURL = $CredentialsBundle['graphite_url'];

if (isset($CredentialsBundle['graphite_url_vanity'])) {
$this->GraphiteURLVanity = $CredentialsBundle['graphite_url_vanity'];
} else {
$this->GraphiteURLVanity = $CredentialsBundle['graphite_url'];
}

//These are optional if people are using HTTP basic auth to protect Graphite
if(isset($CredentialsBundle['graphite_username']) && !empty($CredentialsBundle['graphite_username']))
$this->GraphiteUserName = $CredentialsBundle['graphite_username'];
Expand Down Expand Up @@ -618,7 +624,7 @@ private function SendAlert($Component, $Message, $Severity, $Metric = '', $Trip
if (is_null($Trip))
$Trip = 10;

$url = $this->GraphiteURL . "/render/?target=$Metric&target=alias(threshold($Trip),\"Threshold\")&height=300&width=500&from=-2hours";
$url = $this->GraphiteURLVanity . "/render/?target=$Metric&target=alias(threshold($Trip),\"Threshold\")&height=300&width=500&from=-2hours";
$Message .= "\r\n<br /><img src='$url' />";
$Message .= "\r\n<br /><a href='$url' target='_blank'>$url</a>";
}
Expand Down

0 comments on commit 3de6296

Please sign in to comment.