This commit is contained in:
2024-10-14 00:08:40 +02:00
parent dbfba56f66
commit 1462d52e13
4572 changed files with 2658864 additions and 0 deletions

View 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";
}