Beispiel #1
0
            $func->error(t('Dieser Port existiert nicht'));
        } else {
            $device = $db->qry_first("SELECT name, readcommunity, writecommunity, ip FROM %prefix%noc_devices WHERE id = %int%", $port['deviceid']);
            $status = $noc->getSNMPValue($device["ip"], $device["readcommunity"], ".1.3.6.1.2.1.2.2.1.7.{$port["portnr"]}");
            switch ($status) {
                case "1":
                case "up":
                case "up(1)":
                    $newstatus = "2";
                    $statusdescr = "<font color=\"red\">" . t('deaktiviert') . "</font>";
                    $statusdb = "down(2)";
                    break;
                case "2":
                case "down":
                case "down(2)":
                    $newstatus = "1";
                    $statusdescr = "<font color=\"green\">" . t('aktiviert') . "</font>";
                    $statusdb = "up(1)";
                    break;
            }
            if ($noc->setSNMPValue($device["ip"], $device["writecommunity"], ".1.3.6.1.2.1.2.2.1.7.{$port["portnr"]}", "i", $newstatus)) {
                $db->qry_first("UPDATE %prefix%noc_ports SET adminstatus=%string% WHERE portid=%int%", $statusdb, $_GET["portid"]);
                $func->confirmation(t('Der Portstatus wurde ge&auml;ndert'), "index.php?mod=noc&action=port_details&portid={$_GET["portid"]}");
            } else {
                $func->error(t('Der Port auf konnte nicht ge&auml;ndert werden.HTML_NEWLINE
											 Pr&uuml;fen sie die Einstellung der Write-Community'), "index.php?mod=noc&action=port_details&portid={$_GET["portid"]}");
            }
        }
        //port exists
        break;
}
Beispiel #2
0
                        case "1":
                        case "up":
                        case "up(1)":
                            $newstatus = "2";
                            $statusdescr = "<font color=\"red\">" . t('deaktiviert') . "</font>";
                            $statusdb = "down(2)";
                            break;
                        case "2":
                        case "down":
                        case "down(2)":
                            $newstatus = "1";
                            $statusdescr = "<font color=\"green\">" . t('aktiviert') . "</font>";
                            $statusdb = "up(1)";
                            break;
                    }
                    if ($noc->setSNMPValue($row["ip"], $row["writecommunity"], ".1.3.6.1.2.1.2.2.1.7.{$noc_data}", "i", $newstatus)) {
                        $db->qry_first("UPDATE %prefix%noc_ports SET adminstatus=%string% WHERE portnr=%string% AND deviceid=%int%", $statusdb, $noc_data, $_GET['deviceid']);
                        $text .= $noc_data . t('Der Portstatus wurde ge&auml;ndert') . HTML_NEWLINE;
                    } else {
                        $text .= $noc_data . t('Der Port auf konnte nicht ge&auml;ndert werden.HTML_NEWLINE
											 Pr&uuml;fen sie die Einstellung der Write-Community') . HTML_NEWLINE;
                    }
                }
                if ($noc_error == 1) {
                    $func->error($text, "index.php?mod=noc&action=details_device&deviceid=" . $_GET["deviceid"]);
                } else {
                    $func->confirmation($text, "index.php?mod=noc&action=details_device&deviceid=" . $_GET["deviceid"]);
                }
            } elseif (isset($_SESSION['noc_ports'])) {
                $device = $db->qry_first("SELECT name, readcommunity, writecommunity, ip FROM %prefix%noc_devices WHERE id = %int%", $_SESSION['noc_ports']);
                $status = $noc->getSNMPValue($row["ip"], $row["readcommunity"], ".1.3.6.1.2.1.2.2.1.7.{$_SESSION['noc_ports']}");