Code: Select all
$ diff graph_view.php.original graph_view.php
29a30
> include("./lib/snmp.php");
265a267,316
> /*start SNMP Information*/
> html_graph_start_box(1, true);
> $host = db_fetch_row("select * from host where id=" . $_REQUEST["host_id"]);
> print "<table width='98%' style='background-color: #6d88ad; border: 1px solid #bbbbbb;' align='center' cellspacing='2' cellpadding='3' border='0'>
> <td colspan='" . read_graph_config_option("num_columns") . "' class='textHeaderDark'>
> <strong>" . $host["description"] . " (" . $host["hostname"] .")" . "</strong><br />";
> if ($host["notes"]) { print "Description: " . $host["notes"] . "<br />"; }
> print "<br />
> <strong>SNMP Information</strong><br>
> <span style='font-size: 10px; font-weight: normal; font-family: monospace;'>";
> $header_label = "[edit: " . $host["description"] . "]";
>
> if ((($host["snmp_community"] == "") && ($host["snmp_username"] == "")) || ($host["snmp_version"] == 0)) {
> 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"],NULL,NULL,NULL,NULL, $host["snmp_port"], $host["snmp_timeout"],NULL,NULL);
>
> 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"],NULL,NULL,NULL,NULL, $host["snmp_port"], $host["snmp_timeout"],NULL,NULL);
> $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"],NULL,NULL,NULL,NULL, $host["snmp_port"], $host["snmp_timeout"],NULL,NULL);
> $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"],NULL,NULL,NULL,NULL, $host["snmp_port"], $host["snmp_timeout"],NULL,NULL);
>
> $y = 31536000;
> $w = 604800;
> $d = 86400;
> $h = 3600;
> $mn = 60;
> $s = round($snmp_uptime/100);
> $year = (floor($s/$y));
> $month = (floor($s%$y));
> $week = (floor(($s%$y)/$w));
> $day = (floor((($s%$y)%$w)/$d));
> $hour = (floor(((($s%$y)%$w)%$d)/$h));
> $min = (floor((((($s%$y)%$w)%$d)%$h)/$mn));
> $sec = ((((($s%$y)%$w)%$d)%$h)%$mn);
>
> print "System: '$snmp_system'<br>\n";
> print "<span style='color: #00FF00; font-size: 12px; font-weight: bold;'>Uptime: $year yr(s) $week wk(s) $day day(s) $hour hr(s) $min min(s) $sec sec(s)</span><br>\n";
> print "Hostname: '$snmp_hostname'<br>\n";
> print "Location: '$snmp_location'<br>\n";
>
> }
> }
> print "</span></td>";
> html_graph_end_box();
> print "<br>";