Skip to content

Instantly share code, notes, and snippets.

@rblackwe
Created September 18, 2013 18:08
Show Gist options
  • Save rblackwe/6613078 to your computer and use it in GitHub Desktop.
Save rblackwe/6613078 to your computer and use it in GitHub Desktop.
I tool to help with constructing URIs for Graphite. (Tuned for https://www.hostedgraphite.com/)
use URI;
use HTML::Display;
my $prams = {
target => [qw(ad_live ad_static ad_live_html ad_static_html)],
height => 800,
width => 1600,
from => "-3hours",
yMax => ".2",
lineMode => "connected",
};
my $uri = URI->new("https://www.hostedgraphite.com");
$uri->path( "{API KEY}/graphite/render/");
$uri->query_form( $prams );
my $html = <<'END_HTML';
<html>
<body>
<h1>Title</h1>
<img src='%s' height="%s" width="%s">
<ul>
<li><a href="http://graphite.readthedocs.org/en/1.0/functions.html">Functions</a></li>
<li><a href="http://graphite.readthedocs.org/en/1.0/url-api.html">URI</a></li>
</ul>
</body>
</html>
END_HTML
display(sprintf($html, $uri->as_string,$params->{height},$params->{width}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment