File: alteon_sessions_aggregation.inc.php

package info (click to toggle)
jffnms 0.8.3dfsg.1-2.1etch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 4,928 kB
  • ctags: 5,050
  • sloc: php: 19,981; sh: 266; makefile: 91; perl: 52
file content (44 lines) | stat: -rw-r--r-- 1,416 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
/* Alteon Load Balancing Switch Sessions Graph. This file is part of JFFNMS
 * Copyright (C) <2005> Craig Small <csmall@enc.com.au>
 * This program is licensed under the GNU GPL, full terms in the LICENSE file
 */

function graph_alteon_sessions_aggregation ($data) { 

    $color_array = array("0","7","D");
    foreach ($color_array as $a) 
    foreach ($color_array as $c) 
    foreach ($color_array as $e) 
    	$colors[] = $a.$a.$c.$c.$e.$e;

    $color_array = array("3","9","F");
    foreach ($color_array as $a) 
    foreach ($color_array as $c) 
    foreach ($color_array as $e) 
    	$colors[] = $a.$a.$c.$c.$e.$e;
    
    $graph_type='AREA';
    foreach ($data[id] as $id) {
    	$interface = $data[$id];
	$used_color = $colors[++$i*4];

	$interace['interface'] = str_replace(':','\:',$interface['interface']);
	$name = $interface['interface'].' '.$interface['description'];

	$defs = @array_merge ($defs,
    		rrdtool_get_def($interface,array("sessions$id" =>"current_sessions")));
	$graph = @array_merge($graph, array(
        "$graph_type:sessions$id#$used_color:'$name'",
        "GPRINT:sessions$id:MAX:'Max\:%5.2lf '",
        "GPRINT:sessions$id:AVERAGE:'Average\:%5.2lf '",
        "GPRINT:sessions$id:LAST:'Last\:%5.2lf\\n'"
    ));
    $graph_type='STACK';
   } 
    $opts_header[] = "--vertical-label='Sessions'";

    return array ($opts_header, @array_merge($defs,$graph));    
}

?>