init III
This commit is contained in:
36
Perl rancid show port konfig on website/build_site.pl
Normal file
36
Perl rancid show port konfig on website/build_site.pl
Normal file
@@ -0,0 +1,36 @@
|
||||
use DBI;
|
||||
use strict;
|
||||
|
||||
# Variable für SQL Befehle
|
||||
my $sql;
|
||||
|
||||
# DB Parameter
|
||||
my ($db_user, $db_name, $db_pass, $db_host) = ('root', 'observium', 'lunakoshix', 'localhost');
|
||||
|
||||
# DB connect
|
||||
my $dbh = DBI->connect("DBI:mysql:database=$db_name;host=$db_host", $db_user, $db_pass) or die "Cannot connect to DB\n";
|
||||
|
||||
$sql = "select distinct ifname from ports
|
||||
inner join devices on ports.device_id = devices.device_id
|
||||
where devices.type = 'network'
|
||||
order by ifname asc";
|
||||
|
||||
my $rows = $dbh->selectall_arrayref("$sql");
|
||||
foreach (@$rows) {
|
||||
# für jeden Eintrag
|
||||
my $row=$_;
|
||||
my $ifname=$row->[0];
|
||||
print "$ifname\n";
|
||||
}
|
||||
|
||||
$sql = "select hostname from devices
|
||||
where devices.type = 'network'
|
||||
order by hostname asc";
|
||||
|
||||
my $rows = $dbh->selectall_arrayref("$sql");
|
||||
foreach (@$rows) {
|
||||
# für jeden Eintrag
|
||||
my $row=$_;
|
||||
my $hostname=$row->[0];
|
||||
print "$hostname\n";
|
||||
}
|
||||
Reference in New Issue
Block a user