Created
February 22, 2012 09:02
-
-
Save matejuh/1883495 to your computer and use it in GitHub Desktop.
RRD CGI with dynamic given values
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/rrdtool/bin/rrdcgi | |
<html> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
<head> | |
<title>Dynamic ratio</title> | |
</head> | |
<body> | |
<h1>Dynamic ratio</h1> | |
<div> | |
<p> | |
<RRD::GRAPH /var/www/dynamic_flows.png | |
--title="<RRD::CV start> <RRD::CV duration> flows" | |
--start <RRD::CV start> | |
--end start+<RRD::CV duration> | |
-a PNG | |
-i | |
--font LEGEND:7 | |
--imginfo '<img src=../%s width=500>' | |
DEF:flows=/home/matej/telia10g_p3000.rrd:flows:AVERAGE | |
AREA:flows#049cdb:"flows" | |
> | |
<RRD::GRAPH /var/www/dynamic_packets.png | |
--title="<RRD::CV start> <RRD::CV duration> packets" | |
--start <RRD::CV start> | |
--end start+<RRD::CV duration> | |
-a PNG | |
-i | |
--font LEGEND:7 | |
--imginfo '<img src=../%s width=500>' | |
DEF:packets=/home/matej/telia10g_p3000.rrd:packets:AVERAGE | |
AREA:packets#7a43b6:"packets" | |
> | |
<RRD::GRAPH /var/www/dynamic_traffic.png | |
--title="<RRD::CV start> <RRD::CV duration> traffic" | |
--start <RRD::CV start> | |
--end start+<RRD::CV duration> | |
-a PNG | |
-i | |
--font LEGEND:7 | |
--imginfo '<img src=../%s width=500>' | |
DEF:traffic=/home/matej/telia10g_p3000.rrd:traffic:AVERAGE | |
AREA:traffic#66ff00:"traffic" | |
> | |
</p> | |
<p> | |
<RRD::GRAPH /var/www/dynamic_packets_flows.png | |
--title="<RRD::CV start> <RRD::CV duration> packets flows" | |
--start <RRD::CV start> | |
--end start+<RRD::CV duration> | |
-a PNG | |
-i | |
--font LEGEND:7 | |
--imginfo '<img src=../%s width=500>' | |
DEF:packets=/home/matej/telia10g_p3000.rrd:packets:AVERAGE | |
DEF:flows=/home/matej/telia10g_p3000.rrd:flows:AVERAGE | |
CDEF:packets_flows=packets,flows,/ | |
LINE:packets_flows#049cdb:"packets/flows" | |
> | |
<RRD::GRAPH /var/www/dynamic_traffic_flows.png | |
--title="<RRD::CV start> <RRD::CV duration> traffic flows" | |
--start <RRD::CV start> | |
--end start+<RRD::CV duration> | |
-a PNG | |
-i | |
--font LEGEND:7 | |
--imginfo '<img src=../%s width=500>' | |
DEF:traffic=/home/matej/telia10g_p3000.rrd:traffic:AVERAGE | |
DEF:flows=/home/matej/telia10g_p3000.rrd:flows:AVERAGE | |
CDEF:traffic_flows=traffic,flows,/ | |
LINE:traffic_flows#7a43b6:"traffic/flows" | |
> | |
<RRD::GRAPH /var/www/dynamic_traffic_packets.png | |
--title="<RRD::CV start> <RRD::CV duration> traffic packets" | |
--start <RRD::CV start> | |
--end start+<RRD::CV duration> | |
-a PNG | |
-i | |
--font LEGEND:7 | |
--imginfo '<img src=../%s width=500>' | |
DEF:traffic=/home/matej/telia10g_p3000.rrd:traffic:AVERAGE | |
DEF:packets=/home/matej/telia10g_p3000.rrd:packets:AVERAGE | |
CDEF:traffic_packets=traffic,packets,/ | |
LINE:traffic_packets#66ff00:"traffic/packets" | |
> | |
</p> | |
</div> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
<head> | |
<title>Get ratio</title> | |
<link rel="stylesheet" href="./css/cupertino/jquery-ui-1.8.17.custom.css"> | |
<script src="./js/jquery-1.7.1.min.js"></script> | |
<script src="./js/jquery-ui-1.8.17.custom.min.js"></script> | |
<script src="./js/jquery-ui-1.8.17.custom.js"></script> | |
<script src="./js/jquery.ui.core.js"></script> | |
<script src="./js/jquery.ui.datepicker.js"></script> | |
<script> | |
$(function() { | |
$("#datepicker").datepicker({ dateFormat: 'dd.mm.yy',defaultDate: "10.10.2011",firstDay: 1}); | |
$("#datepicker").datepicker( "option", "currentText", 'Now' ); | |
$("#datepicker").datepicker( "option", "minDate", '01.09.2011'); | |
$("#datepicker").datepicker( "option", "maxDate", '-1d'); | |
}); | |
</script> | |
<script> | |
function getUnixTime(val) { | |
date=$("#datepicker").datepicker("getDate"); | |
timestamp=Math.round(date.getTime() / 1000); | |
//console.log(timestamp); | |
document.getElementById('start').value=timestamp; | |
} | |
</script> | |
</head> | |
<body> | |
<div> | |
<form action="./cgi-bin/dynamic_ratio.cgi" method="get" > | |
<label>Start: </label><input type="text" id="datepicker" onchange="getUnixTime()"> | |
<input type="hidden" name="start" id="start" value=""> | |
<label>End: </label><input type="text" name="duration" value="1day"> | |
</p> | |
<input type="submit" value="Submit"> | |
</form> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment