mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
fixing some permissions things
git-svn-id: http://www.observium.org/svn/observer/trunk@298 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
56
contrib/generate-dnstext.php
Executable file
56
contrib/generate-dnstext.php
Executable file
@@ -0,0 +1,56 @@
|
||||
#!/usr/bin/php
|
||||
<?php
|
||||
|
||||
include("../config.php");
|
||||
include("../includes/functions.php");
|
||||
|
||||
$link = mysql_connect($config['db_host'], $config['db_user'], $config['db_pass']);
|
||||
$db = mysql_select_db($config['db_name'], $link);
|
||||
|
||||
|
||||
$query = "SELECT * FROM ipaddr AS A, interfaces as I, devices as D WHERE A.interface_id = I.interface_id AND I.device_id = D.device_id AND D.os = 'ios'";
|
||||
$data = mysql_query($query, $link);
|
||||
while($ip = mysql_fetch_array($data)) {
|
||||
unset($sub);
|
||||
$hostname = $ip['hostname'];
|
||||
|
||||
$real_hostname = $hostname;
|
||||
|
||||
$hostname = str_replace(".jtibs.net", "", $hostname);
|
||||
$hostname = str_replace(".wtibs.net", "", $hostname);
|
||||
$hostname = str_replace(".jerseytelecom.net", "", $hostname);
|
||||
|
||||
list($loc, $host) = explode("-", $hostname);
|
||||
if($host) {
|
||||
$hostname = "$host.$loc.v4.jerseytelecom.net";
|
||||
} else {
|
||||
$host = $loc; unset ($loc);
|
||||
$hostname = "$host.v4.jerseytelecom.net";
|
||||
}
|
||||
|
||||
$interface = $ip['ifDescr'];
|
||||
$address = $ip['addr'];
|
||||
$cidr = $ip['cidr'];
|
||||
$interface = strtolower(makeshortif(fixifname($interface)));
|
||||
$interface = str_replace("/", "-", $interface);
|
||||
$interface = str_replace(":", "_", $interface);
|
||||
list($interface, $sub) = explode(".", $interface);
|
||||
if($sub) {
|
||||
$sub = str_replace(" ", "", $sub);
|
||||
$sub = str_replace("aal5", "", $sub);
|
||||
$interface = "$sub.$interface";
|
||||
}
|
||||
$hostip = trim(gethostbyname($real_hostname));
|
||||
|
||||
list($first, $second, $third, $fourth) = explode(".", $address);
|
||||
$revzone = "$third.$second.$first.in-addr.arpa";
|
||||
$reverse = "$fourth.$revzone";
|
||||
$dnsname = "$interface.$hostname";
|
||||
|
||||
echo(str_pad($reverse, 35)."IN ADDR ".str_pad($dnsname, 30)." $real_hostname\n");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
@@ -111,9 +111,9 @@ if($config['show_locations']) { echo("<li><a class='menu2four' href='locations/'
|
||||
|
||||
<?php
|
||||
|
||||
$errored = mysql_result(mysql_query("SELECT COUNT(*) FROM interfaces WHERE (in_errors > '0' OR out_errors > '0')"),0);
|
||||
if($errored) {
|
||||
echo("<li><a href='interfaces/errors/'><img src='images/16/chart_curve_error.png' border=0 align=absmiddle> Errored ($errored)</a></li>");
|
||||
#$errored = mysql_result(mysql_query("SELECT COUNT(*) FROM interfaces WHERE (in_errors > '0' OR out_errors > '0')"),0);
|
||||
if($interfaces['errored']) {
|
||||
echo("<li><a href='interfaces/errors/'><img src='images/16/chart_curve_error.png' border=0 align=absmiddle> Errored (".$interfaces['errored'].")</a></li>");
|
||||
}
|
||||
|
||||
if($config['enable_billing']) { echo("<li><a href='bills/'><img src='images/16/money_pound.png' border=0 align=absmiddle> Traffic Bills</a></li>"); $ifbreak = 1;}
|
||||
|
@@ -13,6 +13,8 @@ $interfaces['up'] = mysql_result(mysql_query("SELECT count(*) FROM interfaces AS
|
||||
$interfaces['down'] = mysql_result(mysql_query("SELECT count(*) FROM interfaces AS I, devices AS D WHERE I.ifOperStatus = 'down' AND I.ifAdminStatus = 'up' AND I.ignore = '0' AND D.device_id = I.device_id AND D.ignore = '0'"),0);
|
||||
$interfaces['shutdown'] = mysql_result(mysql_query("SELECT count(*) FROM interfaces AS I, devices AS D WHERE I.ifAdminStatus = 'down' AND I.ignore = '0' AND D.device_id = I.device_id AND D.ignore = '0'"),0);
|
||||
$interfaces['ignored'] = mysql_result(mysql_query("SELECT count(*) FROM interfaces AS I, devices AS D WHERE D.device_id = I.device_id AND ( I.ignore = '1' OR D.ignore = '1')"),0);
|
||||
$interfaces['errored'] = mysql_result(mysql_query("SELECT count(*) FROM interfaces AS I, devices AS D WHERE D.device_id = I.device_id AND ( I.ignore = '0' OR D.ignore = '0') AND (I.in_errors > '0' OR I.out_errors > '0')"),0);
|
||||
|
||||
|
||||
$services['count'] = mysql_result(mysql_query("SELECT count(service_id) FROM services"),0);
|
||||
$services['up'] = mysql_result(mysql_query("SELECT count(service_id) FROM services WHERE service_status = '1' AND service_ignore ='0'"),0);
|
||||
@@ -31,6 +33,7 @@ $services['disabled'] = mysql_result(mysql_query("SELECT count(service_id) FROM
|
||||
$interfaces['up'] = mysql_result(mysql_query("SELECT count(*) FROM interfaces AS I, devices AS D, devices_perms AS P WHERE P.user_id = '" . $_SESSION['user_id'] . "' AND P.device_id = D.device_id AND I.device_id = D.device_id AND ifOperStatus = 'up'"),0);
|
||||
$interfaces['down'] = mysql_result(mysql_query("SELECT count(*) FROM interfaces AS I, devices AS D, devices_perms AS P WHERE P.user_id = '" . $_SESSION['user_id'] . "' AND P.device_id = D.device_id AND I.device_id = D.device_id AND ifOperStatus = 'down' AND ifAdminStatus = 'up'"),0);
|
||||
$interfaces['disabled'] = mysql_result(mysql_query("SELECT count(*) FROM interfaces AS I, devices AS D, devices_perms AS P WHERE P.user_id = '" . $_SESSION['user_id'] . "' AND P.device_id = D.device_id AND I.device_id = D.device_id AND ifAdminStatus = 'down'"),0);
|
||||
$interfaces['errored'] = mysql_result(mysql_query("SELECT count(*) FROM interfaces AS I, devices AS D, devices_perms AS P WHERE P.user_id = '" . $_SESSION['user_id'] . "' AND P.device_id = D.device_id AND I.device_id = D.device_id AND (I.in_errors > '0' OR I.out_errors > '0')"),0);
|
||||
|
||||
$services['count'] = mysql_result(mysql_query("SELECT count(service_id) FROM services AS S, devices AS D, devices_perms AS P WHERE P.user_id = '" . $_SESSION['user_id'] . "' AND P.device_id = D.device_id AND S.service_host = D.device_id"),0);
|
||||
$services['up'] = mysql_result(mysql_query("SELECT count(service_id) FROM services AS S, devices AS D, devices_perms AS P WHERE P.user_id = '" . $_SESSION['user_id'] . "' AND P.device_id = D.device_id AND S.service_host = D.device_id AND service_status = '1' AND service_ignore ='0'"),0);
|
||||
|
Reference in New Issue
Block a user