diff options
author | Jonathan Prykop <jonathan@freeside.biz> | 2015-04-30 17:28:36 -0500 |
---|---|---|
committer | Jonathan Prykop <jonathan@freeside.biz> | 2015-04-30 17:28:36 -0500 |
commit | f715c23517292a11330ab241fb13221fd89ffc37 (patch) | |
tree | 8a1ecadf07c694e5d4541f804ef40ac74eebf553 /httemplate/edit/elements/part_export | |
parent | 3acf33a87b4e8ebaac08652177d79b22721e2690 (diff) |
RT#18834: Cacti integration [added graph generation]
Diffstat (limited to 'httemplate/edit/elements/part_export')
-rw-r--r-- | httemplate/edit/elements/part_export/cacti.html | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/httemplate/edit/elements/part_export/cacti.html b/httemplate/edit/elements/part_export/cacti.html new file mode 100644 index 000000000..9e4a8ecd7 --- /dev/null +++ b/httemplate/edit/elements/part_export/cacti.html @@ -0,0 +1,42 @@ +<table bgcolor="#cccccc" border=0 cellspacing=3> +<TR> + <TH>Graph Template ID</TH> + <TH>SNMP Query ID</TH> + <TH>SNMP Query Type ID</TH> + <TH>SNMP Field</TH> + <TH>SNMP Value</TH> +</TR> +<TR id="mytemplate"> + <TD><INPUT TYPE="text" NAME="graph_template_id" ID="graph_template_id"></TD> + <TD><INPUT TYPE="text" NAME="snmp_query_id" ID="snmp_query_id"></TD> + <TD><INPUT TYPE="text" NAME="snmp_query_type_id" ID="snmp_query_type_id"></TD> + <TD><INPUT TYPE="text" NAME="snmp_field" ID="snmp_field"></TD> + <TD><INPUT TYPE="text" NAME="snmp_value" ID="snmp_value"></TD> +</TR> +<& /elements/auto-table.html, + template_row => 'mytemplate', + fieldorder => ['graph_template_id','snmp_query_id','snmp_query_type_id','snmp_field','snmp_value'], + data => \@data, + table => 'cacti', +&> +</table> +<INPUT TYPE="hidden" name="multi_options" value="<% $multiopts %>"> +<%init> +my %opt = @_; +my $part_export = $opt{part_export} || die "No part_export specified"; + +my @fields = ('cacti_graph_template_id','cacti_snmp_query_id','cacti_snmp_query_type_id','cacti_snmp_field','cacti_snmp_value'); +my $multiopts = join(',',@fields); +my @byfield = map { + [ split("\n", $part_export->option($_)) ] +} @fields; +my @data; +for (my $i = 0; $i < @{$byfield[0]}; $i++) { + my @thisrow; + for (my $j = 0; $j < @byfield; $j++) { + push(@thisrow,$byfield[$j][$i]); + } + push(@data,\@thisrow); +} + +</%init> |