You have to paste the following code in your graph_view.php between line 256 to 276.
I have cacti 0.8.4.
Code: Select all
print "<table width='98%' style='background-color: #f5f5f5; border: 1px solid #bbbbbb;' align='center' cellspacing='2' cellpadding='3' border='0'>
<tr bgcolor='#" . $colors["header_panel"] . "'>
<td colspan='" . read_graph_config_option("num_columns") . "' class='textHeaderDark'>
<strong>SNMP Information</strong><br>
<span style='font-size: 10px; font-weight: normal; font-family: monospace;'>";
$host = db_fetch_row("select * from host where id=" . $_REQUEST["host_id"]);
$header_label = "[edit: " . $host["description"] . "]";
if (($host["snmp_community"] == "") && ($host["snmp_username"] == "")) {
print "<span style='color: #ab3f1e; font-weight: bold;'>SNMP not in use</span>\n";
}else{
$snmp_system = cacti_snmp_get($host["hostname"], $host["snmp_community"], ".1.3.6.1.2.1.1.1.0", $host["snmp_version"], $host["snmp_username"], $host["snmp_password"], $host["snmp_port"], $host["snmp_timeout"]);
if ($snmp_system == "") {
print "<span style='color: #ff0000; font-weight: bold;'>SNMP error</span>\n";
}else{
$snmp_uptime = cacti_snmp_get($host["hostname"], $host["snmp_community"], ".1.3.6.1.2.1.1.3.0", $host["snmp_version"], $host["snmp_username"], $host["snmp_password"], $host["snmp_port"], $host["snmp_timeout"]);
$snmp_hostname = cacti_snmp_get($host["hostname"], $host["snmp_community"], ".1.3.6.1.2.1.1.5.0", $host["snmp_version"], $host["snmp_username"], $host["snmp_password"], $host["snmp_port"], $host["snmp_timeout"]);
$snmp_location = cacti_snmp_get($host["hostname"], $host["snmp_community"], ".1.3.6.1.2.1.1.6.0", $host["snmp_version"], $host["snmp_username"], $host["snmp_password"], $host["snmp_port"], $host["snmp_timeout"]);
print "System: '$snmp_system'<br>\n";
print "Uptime: '$snmp_uptime'<br>\n";
print "Hostname: '$snmp_hostname'<br>\n";
print "Location: '$snmp_location'<br>\n";
}
}
print "</span></td></tr></table>";
print "<table width='98%' style='background-color: #f5f5f5; border: 1px solid #bbbbbb;' align='center'><tr>";
$i = 0; $k = 0;
if (sizeof($graphs) > 0) {
foreach ($graphs as $graph) {
print "<td align='center' width='" . (98 / read_graph_config_option("num_columns")) . "%'><br><a href='graph.php?rra_id=all&local_graph_id=" . $graph["local_graph_id"] . "'><img src='graph_image.php?local_graph_id=" . $graph["local_graph_id"] . "&rra_id=" . (empty($set_rra_id) ? read_graph_config_option("default_rra_id") : $set_rra_id) . "&graph_start=-" . (empty($set_rra_id) ? read_graph_config_option("timespan") : "0") . "&graph_height=" . read_graph_config_option("default_height") . "&graph_width=" . read_graph_config_option("default_width") . "&graph_nolegend=true' border='0' alt='" . $graph["title_cache"] . "'></a></td>\n";
$i++;
$k++;
if (($i == read_graph_config_option("num_columns")) && ($k < count($graphs))) {
$i = 0;
print "</tr><tr>";
}
}
}else{
print "<td><em>No Graphs Found.</em></td>";
}
print "</tr></table>";
print "<br><br>";
print "<table width='98%' style='background-color: #f5f5f5; border: 1px solid #bbbbbb;' align='center' cellspacing='2' cellpadding='3' border='0'>
<tr bgcolor='#" . $colors["header_panel"] . "'>
<td colspan='" . read_graph_config_option("num_columns") . "' class='textHeaderDark'>
<strong>SNMP Information</strong><br>
<span style='font-size: 10px; font-weight: normal; font-family: monospace;'>";
$host = db_fetch_row("select * from host where id=" . $_REQUEST["host_id"]);
$header_label = "[edit: " . $host["description"] . "]";
if (($host["snmp_community"] == "") && ($host["snmp_username"] == "")) {
print "<span style='color: #ab3f1e; font-weight: bold;'>SNMP not in use</span>\n";
}else{
$snmp_system = cacti_snmp_get($host["hostname"], $host["snmp_community"], ".1.3.6.1.2.1.1.1.0", $host["snmp_version"], $host["snmp_username"], $host["snmp_password"], $host["snmp_port"], $host["snmp_timeout"]);
if ($snmp_system == "") {
print "<span style='color: #ff0000; font-weight: bold;'>SNMP error</span>\n";
}else{
$snmp_uptime = cacti_snmp_get($host["hostname"], $host["snmp_community"], ".1.3.6.1.2.1.1.3.0", $host["snmp_version"], $host["snmp_username"], $host["snmp_password"], $host["snmp_port"], $host["snmp_timeout"]);
$snmp_hostname = cacti_snmp_get($host["hostname"], $host["snmp_community"], ".1.3.6.1.2.1.1.5.0", $host["snmp_version"], $host["snmp_username"], $host["snmp_password"], $host["snmp_port"], $host["snmp_timeout"]);
$snmp_location = cacti_snmp_get($host["hostname"], $host["snmp_community"], ".1.3.6.1.2.1.1.6.0", $host["snmp_version"], $host["snmp_username"], $host["snmp_password"], $host["snmp_port"], $host["snmp_timeout"]);
print "System: '$snmp_system'<br>\n";
print "Uptime: '$snmp_uptime'<br>\n";
print "Hostname: '$snmp_hostname'<br>\n";
print "Location: '$snmp_location'<br>\n";
}
}
print "</span></td></tr></table>";
print "<table width='98%' style='background-color: #f5f5f5; border: 1px solid #bbbbbb;' align='center'><tr>";
$i = 0; $k = 0;
if (sizeof($graphs) > 0) {
foreach ($graphs as $graph) {
print "<td align='center' width='" . (98 / read_graph_config_option("num_columns")) . "%'><br><a href='graph.php?rra_id=all&local_graph_id=" . $graph["local_graph_id"] . "'><img src='graph_image.php?local_graph_id=" . $graph["local_graph_id"] . "&rra_id=" . (empty($set_rra_id) ? read_graph_config_option("default_rra_id") : $set_rra_id) . "&graph_start=-" . (empty($set_rra_id) ? read_graph_config_option("timespan") : "0") . "&graph_height=" . read_graph_config_option("default_height") . "&graph_width=" . read_graph_config_option("default_width") . "&graph_nolegend=true' border='0' alt='" . $graph["title_cache"] . "'></a></td>\n";
$i++;
$k++;
if (($i == read_graph_config_option("num_columns")) && ($k < count($graphs))) {
$i = 0;
print "</tr><tr>";
}
}
}else{
print "<td><em>No Graphs Found.</em></td>";
}
print "</tr></table>";
print "<br><br>";
Code: Select all
include_once("./lib/snmp.php")
Code: Select all
<tr>
Code: Select all
</table>