mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
some graph cleanups and minor improvements
git-svn-id: http://www.observium.org/svn/observer/trunk@1161 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -38,42 +38,42 @@
|
||||
|
||||
$rrd_options .= " COMMENT:'Packets/sec Current Average Maximum\\n'";
|
||||
|
||||
$rrd_options .= " AREA:InReceives_4#003300:'InReceives v4'";
|
||||
$rrd_options .= " AREA:InReceives_4#CDEB8B:'InReceives v4'";
|
||||
$rrd_options .= " GPRINT:InReceives_4:LAST:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:InReceives_4:AVERAGE:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:InReceives_4:MAX:%6.2lf%s\\\\n";
|
||||
|
||||
$rrd_options .= " AREA:InReceives_6#91B13C:' v6':STACK";
|
||||
$rrd_options .= " AREA:InReceives_6#8C9E5E:' v6':STACK";
|
||||
$rrd_options .= " GPRINT:InReceives_6:LAST:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:InReceives_6:AVERAGE:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:InReceives_6:MAX:%6.2lf%s\\\\n";
|
||||
|
||||
$rrd_options .= " AREA:OutRequests_4_n#000033:'OutRequests v4'";
|
||||
$rrd_options .= " AREA:OutRequests_4_n#C3D9FF:'OutRequests v4'";
|
||||
$rrd_options .= " GPRINT:OutRequests_4:LAST:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:OutRequests_4:AVERAGE:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:OutRequests_4:MAX:%6.2lf%s\\\\n";
|
||||
|
||||
$rrd_options .= " AREA:OutRequests_6_n#8080BD:' v6':STACK";
|
||||
$rrd_options .= " AREA:OutRequests_6_n#8D9CB7:' v6':STACK";
|
||||
$rrd_options .= " GPRINT:OutRequests_6:LAST:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:OutRequests_6:AVERAGE:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:OutRequests_6:MAX:%6.2lf%s\\\\n";
|
||||
|
||||
$rrd_options .= " LINE1.25:InForwDatagrams_4#AF63AF:'InForward v4'";
|
||||
$rrd_options .= " AREA:InForwDatagrams_4#AF63AF:'InForward v4'";
|
||||
$rrd_options .= " GPRINT:InForwDatagrams_4:LAST:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:InForwDatagrams_4:AVERAGE:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:InForwDatagrams_4:MAX:%6.2lf%s\\\\n";
|
||||
|
||||
$rrd_options .= " LINE1.25:InForwDatagrams_6#3F003F:' v6'";
|
||||
$rrd_options .= " AREA:InForwDatagrams_6#3F003F:' v6':STACK";
|
||||
$rrd_options .= " GPRINT:InForwDatagrams_6:LAST:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:InForwDatagrams_6:AVERAGE:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:InForwDatagrams_6:MAX:%6.2lf%s\\\\n";
|
||||
|
||||
$rrd_options .= " LINE1.25:OutForwDatagrams_4#AF63AF:'OutForward v4'";
|
||||
$rrd_options .= " AREA:OutForwDatagrams_4#AF63AF:'OutForward v4'";
|
||||
$rrd_options .= " GPRINT:OutForwDatagrams_4:LAST:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:OutForwDatagrams_4:AVERAGE:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:OutForwDatagrams_4:MAX:%6.2lf%s\\\\n";
|
||||
|
||||
$rrd_options .= " LINE1.25:OutForwDatagrams_6#3F003F:' v6'";
|
||||
$rrd_options .= " AREA:OutForwDatagrams_6#3F003F:' v6':STACK";
|
||||
$rrd_options .= " GPRINT:OutForwDatagrams_6:LAST:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:OutForwDatagrams_6:AVERAGE:%6.2lf%s";
|
||||
$rrd_options .= " GPRINT:OutForwDatagrams_6:MAX:%6.2lf%s\\\\n";
|
||||
|
@@ -42,15 +42,16 @@ if(is_numeric($_GET['topn'])) { $topn = $_GET['topn']; } else { $topn = '10'; }
|
||||
while($acc = mysql_fetch_array($query)) {
|
||||
$this_rrd = $config['rrd_dir'] . "/" . $acc['hostname'] . "/" . safename("cip-" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd");
|
||||
if(is_file($this_rrd)) {
|
||||
$name = $acc['mac'];
|
||||
$mac = formatmac($acc['mac']);
|
||||
$name = $mac;
|
||||
$addy = mysql_fetch_array(mysql_query("SELECT * FROM ipv4_mac where mac_address = '".$acc['mac']."' AND interface_id = '".$acc['interface_id']."'"));
|
||||
if($addy) {
|
||||
$name = $addy['ipv4_address'];
|
||||
$name = $addy['ipv4_address'] . " (".$mac.")";
|
||||
$peer = mysql_fetch_array(mysql_query("SELECT * FROM ipv4_addresses AS A, ports AS I, devices AS D
|
||||
WHERE A.ipv4_address = '".$addy['ipv4_address']."'
|
||||
AND I.interface_id = A.interface_id AND D.device_id = I.device_id"));
|
||||
if($peer) {
|
||||
$name = $peer['hostname'] . " " . $peer['ifDescr'];
|
||||
$name = $peer['hostname'] . " " . makeshortif($peer['ifDescr']) . " (".$mac.")";
|
||||
}
|
||||
|
||||
if(mysql_result(mysql_query("SELECT count(*) FROM bgpPeers WHERE device_id = '".$acc['device_id']."' AND bgpPeerIdentifier = '".
|
||||
@@ -70,6 +71,9 @@ if(is_numeric($_GET['topn'])) { $topn = $_GET['topn']; } else { $topn = '10'; }
|
||||
$colour=$config['graph_colours'][$colours][$iter];
|
||||
$descr = str_pad($name, 36);
|
||||
$descr = substr($descr,0,36);
|
||||
$descr = str_replace("(", "(", $descr);
|
||||
$descr = str_replace(")", ")", $descr);
|
||||
$descr = str_replace(":", "\\:", $descr);
|
||||
$rrd_options .= " DEF:in".$this_id."=$this_rrd:".$prefix."IN:AVERAGE ";
|
||||
$rrd_options .= " DEF:out".$this_id."temp=$this_rrd:".$prefix."OUT:AVERAGE ";
|
||||
$rrd_options .= " CDEF:inB".$this_id."=in".$this_id.",$multiplier,* ";
|
||||
|
@@ -14,16 +14,43 @@ if($hrdevice['hrDeviceType'] == "hrDeviceProcessor") {
|
||||
$proc_popup .= "</div><img src=\'".$config['base_url']."/graph.php?id=" . $proc_id . "&type=processor&from=$month&to=$now&width=400&height=125\'>";
|
||||
$proc_popup .= "', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"";
|
||||
echo("<td><a href='$proc_url' $proc_popup>".$hrdevice['hrDeviceDescr']."</a></td>");
|
||||
|
||||
$graph_array['height'] = "20";
|
||||
$graph_array['width'] = "100";
|
||||
$graph_array['to'] = $now;
|
||||
$graph_array['id'] = $proc_id;
|
||||
$graph_array['type'] = 'processor';
|
||||
$graph_array['from'] = $day;
|
||||
$graph_array_zoom = $graph_array; $graph_array_zoom['height'] = "150"; $graph_array_zoom['width'] = "400";
|
||||
|
||||
$mini_graph = overlib_link($_SERVER['REQUEST_URI'], generate_graph_tag($graph_array), generate_graph_tag($graph_array_zoom), NULL);
|
||||
|
||||
|
||||
echo('<td>'.$mini_graph.'</td>');
|
||||
} elseif ($hrdevice['hrDeviceType'] == "hrDeviceNetwork") {
|
||||
$int = str_replace("network interface ", "", $hrdevice['hrDeviceDescr']);
|
||||
$interface = mysql_fetch_array(mysql_query("SELECT * FROM ports WHERE device_id = '".$device['device_id']."' AND ifDescr = '".$int."'"));
|
||||
if($interface['ifIndex']) {
|
||||
echo("<td>".generateiflink($interface)."</td>");
|
||||
|
||||
$graph_array['height'] = "20";
|
||||
$graph_array['width'] = "100";
|
||||
$graph_array['to'] = $now;
|
||||
$graph_array['id'] = $interface['interface_id'];
|
||||
$graph_array['type'] = 'port_bits';
|
||||
$graph_array['from'] = $day;
|
||||
$graph_array_zoom = $graph_array; $graph_array_zoom['height'] = "150"; $graph_array_zoom['width'] = "400";
|
||||
|
||||
$mini_graph = overlib_link($_SERVER['REQUEST_URI'], generate_graph_tag($graph_array), generate_graph_tag($graph_array_zoom), NULL);
|
||||
|
||||
echo("<td>$mini_graph</td>");
|
||||
} else {
|
||||
echo("<td>".$hrdevice['hrDeviceDescr']."</td>");
|
||||
echo("<td></td>");
|
||||
}
|
||||
} else {
|
||||
echo("<td>".$hrdevice['hrDeviceDescr']."</td>");
|
||||
echo("<td></td>");
|
||||
}
|
||||
|
||||
echo("<td>".$hrdevice['hrDeviceType']."</td><td>".$hrdevice['hrDeviceStatus']."</td>");
|
||||
|
@@ -1,4 +1,4 @@
|
||||
<center>
|
||||
<object data="<?php echo($config['base_url']); ?>/map.php?device=<?php echo($device['device_id']); ?>&format=svg" type="image/svg+xml">
|
||||
<object data="<?php echo($config['base_url']); ?>/map.php?device=<?php echo($device['device_id']); ?>&format=svg" type="image/svg+xml" style="width: 100%; height:1000px;">
|
||||
</object>
|
||||
</center>
|
||||
|
@@ -150,11 +150,11 @@ echo("</div>
|
||||
|
||||
echo("<div style='width: 235px; float: right;'>
|
||||
<a onmouseover=\"return overlib('\
|
||||
<img src=\'graph.php?type=port_bits&port=74&from=".$day."&to=".$now."&width=400&height=150&inverse=0&legend=1\'>\
|
||||
<img src=\'graph.php?type=port_bits&port=74&from=".$week."&to=".$now."&width=400&height=150&inverse=0&legend=1\'>\
|
||||
<img src=\'graph.php?type=port_bits&port=28&from=".$day."&to=".$now."&width=400&height=150&inverse=0&legend=1\'>\
|
||||
<img src=\'graph.php?type=port_bits&port=28&from=".$week."&to=".$now."&width=400&height=150&inverse=0&legend=1\'>\
|
||||
', LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\" >". "
|
||||
<div style='font-size: 16px; font-weight: bold; color: #555555;'>NE61 Server</div>".
|
||||
"<img src='graph.php?type=port_bits&port=74&from=".$day."&to=".$now."&width=155&height=100&inverse=0&legend=no'></a></div>");
|
||||
"<img src='graph.php?type=port_bits&port=28&from=".$day."&to=".$now."&width=155&height=100&inverse=0&legend=no'></a></div>");
|
||||
|
||||
echo("</div>");
|
||||
|
||||
|
@@ -52,11 +52,14 @@ function process_syslog ($entry, $update) {
|
||||
} else {
|
||||
$program = preg_quote($entry['program'],'/');
|
||||
$entry['msg'] = preg_replace("/^$program:\ /", "", $entry['msg']);
|
||||
if(preg_match("/^[a-zA-Z\/]+\[[0-9]+\]:/", $entry['msg'])) {
|
||||
# if(preg_match("/^[a-zA-Z\/]+\[[0-9]+\]:/", $entry['msg'])) {
|
||||
$entry['msg'] = preg_replace("/^(.+?)\[[0-9]+\]:\ /", "\\1||", $entry['msg']);
|
||||
if(!strstr($entry['msg'], "||")) { $entry['msg'] = preg_replace("/^(.+?):\ /", "\\1||", $entry['msg']);}
|
||||
list($entry['program'], $entry['msg']) = explode("||", $entry['msg']);
|
||||
$entry['program'] = preg_replace("@\-[0-9]+@", "", $entry['program']);
|
||||
# }
|
||||
}
|
||||
}
|
||||
$entry['program'] = strtoupper($entry['program']);
|
||||
$x = "UPDATE `syslog` set `device_id` = '".$entry['device_id']."', `program` = '".$entry['program']."', `msg` = '" . mres($entry['msg']) . "', processed = '1' WHERE `seq` = '" . $entry['seq'] . "'";
|
||||
$x = "INSERT INTO `syslog` (`device_id`,`program`,`facility`,`priority`, `level`, `tag`, `msg`, `timestamp`) ";
|
||||
$x .= "VALUES ('".$entry['device_id']."','".$entry['program']."','".$entry['facility']."','".$entry['priority']."', '".$entry['level']."', '".$entry['tag']."', '".$entry['msg']."','".$entry['timestamp']."')";
|
||||
|
Reference in New Issue
Block a user