Пример #1
0
/**
 * Observium
 *
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage graphs
 * @copyright  (C) 2006-2014 Adam Armstrong
 *
 */
// Cycle through dot3stats OIDs and build list of RRAs to pass to multi simplex grapher
$oids = array('drop', 'punt', 'hostpunt');
$i = 0;
if (is_file($rrd_filename)) {
    foreach ($oids as $oid) {
        $oid = str_replace("dot3Stats", "", $oid);
        $oid_ds = truncate($oid, 19, '');
        $rrd_list[$i]['filename'] = $rrd_filename;
        $rrd_list[$i]['descr'] = $oid;
        $rrd_list[$i]['ds'] = $oid_ds;
        $i++;
    }
    $colours = "mixed";
    $nototal = 1;
    $unit_text = "Errors";
    include "includes/graphs/generic_multi_simplex_separated.inc.php";
} else {
    graph_error($type . '_' . $subtype);
    // Graph Template Missing;
}
// EOF
Пример #2
0
                                imagecopy($dst_im, $src_im, $dst_x, $dst_y, $src_x, $src_y, $src_w, $src_h);
                                imagepng($dst_im);
                                imagedestroy($dst_im);
                            } else {
                                $fd = fopen($graphfile, 'r');
                                fpassthru($fd);
                                fclose($fd);
                            }
                        } else {
                            echo `ls -l {$graphfile}`;
                            echo '<img src="' . data_uri($graphfile, 'image/png') . '" alt="graph" />';
                        }
                        unlink($graphfile);
                    } else {
                        if ($width < 200) {
                            graph_error('Draw Error');
                        } else {
                            graph_error('Error Drawing Graph');
                        }
                    }
                } else {
                    if ($width < 200) {
                        graph_error('Def Error');
                    } else {
                        graph_error('Graph Definition Error');
                    }
                }
            }
        }
    }
}
Пример #3
0
            }
            if (is_file($graphfile)) {
                if ($vars['image_data_uri'] == TRUE) {
                    $image_data_uri = data_uri($graphfile, 'image/png');
                } elseif (!$debug) {
                    header('Content-type: image/png');
                    $fd = fopen($graphfile, 'r');
                    fpassthru($fd);
                    fclose($fd);
                } else {
                    echo `ls -l {$graphfile}`;
                    echo '<img src="' . data_uri($graphfile, 'image/png') . '" alt="graph" />';
                }
                unlink($graphfile);
            } else {
                if ($width < 200) {
                    graph_error("Draw Error");
                } else {
                    graph_error("Draw Error");
                }
            }
        } else {
            if ($width < 200) {
                graph_error("定义错误");
            } else {
                graph_error("图像定义错误");
            }
        }
    }
}
// EOF
Пример #4
0
                                fclose($fd);
                            } else {
                                external_exec('/bin/ls -l ' . $graphfile);
                                echo '<img src="' . data_uri($graphfile, 'image/png') . '" alt="graph" />';
                            }
                        }
                        unlink($graphfile);
                    } else {
                        if ($width < 200) {
                            graph_error("Draw Error");
                        } else {
                            graph_error("Error Drawing Graph");
                        }
                    }
                } else {
                    if ($width < 200) {
                        graph_error("Def Error");
                    } else {
                        graph_error("Graph Definition Error");
                    }
                }
            }
        }
    }
}
// Total runtime and clean graph file
$graph_return['total'] = utime() - $total_start;
if (strlen($graph_return['filename']) && is_file($graph_return['filename'])) {
    unlink($graph_return['filename']);
}
// EOF
Пример #5
0
if (is_numeric($vars['id'])) {
    $acc = dbFetchRow('SELECT * FROM `mac_accounting` AS M, `ports` AS I, `devices` AS D WHERE M.ma_id = ? AND I.port_id = M.port_id AND I.device_id = D.device_id', array($vars['id']));
    if ($debug) {
        echo '<pre>';
        print_r($acc);
        echo '</pre>';
    }
    if (is_array($acc)) {
        if ($auth || port_permitted($acc['port_id'])) {
            d_echo($config['rrd_dir'] . '/' . $acc['hostname'] . '/' . safename('cip-' . $acc['ifIndex'] . '-' . $acc['mac'] . '.rrd'));
            if (is_file($config['rrd_dir'] . '/' . $acc['hostname'] . '/' . safename('cip-' . $acc['ifIndex'] . '-' . $acc['mac'] . '.rrd'))) {
                d_echo('exists');
                $rrd_filename = $config['rrd_dir'] . '/' . $acc['hostname'] . '/' . safename('cip-' . $acc['ifIndex'] . '-' . $acc['mac'] . '.rrd');
                $port = get_port_by_id($acc['port_id']);
                $device = device_by_id_cache($port['device_id']);
                $title = generate_device_link($device);
                $title .= ' :: Port  ' . generate_port_link($port);
                $title .= ' :: ' . formatMac($acc['mac']);
                $auth = true;
            } else {
                graph_error('file not found');
            }
        } else {
            graph_error('unauthenticated');
        }
    } else {
        graph_error('entry not found');
    }
} else {
    graph_error('invalid id');
}
Пример #6
0
        print_r($acc);
        echo "</pre>";
    }
    if (is_array($acc)) {
        if ($auth || port_permitted($acc['port_id'])) {
            if ($debug) {
                echo $config['rrd_dir'] . "/" . $acc['hostname'] . "/" . safename("cip-" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd");
            }
            if (is_file($config['rrd_dir'] . "/" . $acc['hostname'] . "/" . safename("cip-" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd"))) {
                if ($debug) {
                    echo "exists";
                }
                $rrd_filename = $config['rrd_dir'] . "/" . $acc['hostname'] . "/" . safename("cip-" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd");
                $port = get_port_by_id($acc['port_id']);
                $device = device_by_id_cache($port['device_id']);
                $title = generate_device_link($device);
                $title .= " :: Port  " . generate_port_link($port);
                $title .= " :: " . formatMac($acc['mac']);
                $auth = TRUE;
            } else {
                graph_error("file not found");
            }
        } else {
            graph_error("unauthenticated");
        }
    } else {
        graph_error("entry not found");
    }
} else {
    graph_error("invalid id");
}