pve-reporting/get_vminfo_clu1.pl aktualisiert
This commit is contained in:
@@ -40,8 +40,9 @@ for $server (@servers) {
|
||||
$vms{$1}{'cores'},
|
||||
$vms{$1}{'description'},
|
||||
$vms{$1}{'tags'},
|
||||
$vms{$1}{'cdrom'}
|
||||
) = $_ =~ /([^|]*).([^|]*).([^|]*).([^|]*).([^|]*).([^|]*).([^|]*).([^|]*).([^|]*)$/gm;
|
||||
$vms{$1}{'cdrom'},
|
||||
$vms{$1}{'nets'}
|
||||
) = $_ =~ /([^|]*).([^|]*).([^|]*).([^|]*).([^|]*).([^|]*).([^|]*).([^|]*).([^|]*).([^|]*)$/gm;
|
||||
@tags=split ";", $vms{$1}{'tags'};
|
||||
print "tags $vms{$1}{'tags'}\n";
|
||||
foreach (@tags) { print "tag $_\n"; $tag{$_}{'name'}=$_; }
|
||||
@@ -80,15 +81,15 @@ printf HTML "<head>\n<body>\n";
|
||||
|
||||
open OUTPUT, ">output1.csv";
|
||||
print "-- print vm information to console and in file output1.csv\n";
|
||||
$hstr = sprintf "VMID|NAME|OS|DISKSIZE(S)|DISKUSAGE(S)|SOCKETS|CORES|MEMORY(MB)|BOOTDISK(GB)|DESCRIPTION|TAGS|STATUS|HOST|PID|CDROM\n";
|
||||
$hstr = sprintf "VMID|NAME|OS|DISKSIZE(S)|DISKUSAGE(S)|SOCKETS|CORES|MEMORY(MB)|BOOTDISK(GB)|NETS|DESCRIPTION|TAGS|STATUS|HOST|PID|CDROM\n";
|
||||
printf $hstr;
|
||||
printf OUTPUT $hstr;
|
||||
|
||||
$str = sprintf "<table border='1' id='example' class='display compact' width='100%'>\n<thead><tr><th>VMID</th><th>NAME</th><th>OS</th><th>DISKSIZE(S)</th><th>DISKUSAGE(S)</th><th>SOCKETS</th><th>CORES</th><th>MEMORY(MB)</th><th>BOOTDISK(GB)</th><th>DESCRIPTION</th><th>TAGS</th><th>STATUS</th><th>HOST</th><th>PID</th><th>CDROM</th></tr></thead>\n";
|
||||
$str = sprintf "<table border='1' id='example' class='display compact' width='100%'>\n<thead><tr><th>VMID</th><th>NAME</th><th>OS</th><th>DISKSIZE(S)</th><th>DISKUSAGE(S)</th><th>SOCKETS</th><th>CORES</th><th>MEMORY(MB)</th><th>BOOTDISK(GB)</th><th>NETS</th><th>DESCRIPTION</th><th>TAGS</th><th>STATUS</th><th>HOST</th><th>PID</th><th>CDROM</th></tr></thead>\n";
|
||||
printf HTML $str;
|
||||
|
||||
foreach $vm (sort keys %vms) {
|
||||
$str = sprintf ("%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s\n",
|
||||
$str = sprintf ("%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s\n",
|
||||
$vm,
|
||||
$vms{$vm}{'name'},
|
||||
$vms{$vm}{'os'},
|
||||
@@ -98,6 +99,7 @@ foreach $vm (sort keys %vms) {
|
||||
$vms{$vm}{'cores'},
|
||||
$vms{$vm}{'memory'},
|
||||
$vms{$vm}{'bootdisk'},
|
||||
$vms{$vm}{'nets'},
|
||||
$vms{$vm}{'description'},
|
||||
$vms{$vm}{'tags'},
|
||||
$vms{$vm}{'status'},
|
||||
@@ -119,18 +121,20 @@ foreach $vm (sort keys %vms) {
|
||||
$allsizes =~ s/;/<br>/g;
|
||||
$allusages = $vms{$vm}{'diskusages'};
|
||||
$allusages =~ s/;/<br>/g;
|
||||
$allnets = $vms{$vm}{'nets'};
|
||||
$allnets =~ s/;/<br>/g;
|
||||
|
||||
$str = sprintf ("<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>\n",
|
||||
$str = sprintf ("<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>\n",
|
||||
$vm,
|
||||
$vms{$vm}{'name'},
|
||||
$vms{$vm}{'os'},
|
||||
$allsizes,
|
||||
$allusages,
|
||||
$vms{$vm}{'diskusages'},
|
||||
$allusages,
|
||||
$vms{$vm}{'sockets'},
|
||||
$vms{$vm}{'cores'},
|
||||
$vms{$vm}{'memory'},
|
||||
$vms{$vm}{'bootdisk'},
|
||||
$vms{$vm}{'nets'},
|
||||
$vms{$vm}{'description'},
|
||||
$alltags,
|
||||
$vms{$vm}{'status'},
|
||||
@@ -152,7 +156,7 @@ foreach $t (keys %tag) {
|
||||
foreach $vm (sort keys %vms) {
|
||||
print "1 $vms{$vm}{'tags'} 2 $tag{$t}{'name'}\n";
|
||||
if ( $vms{$vm}{'tags'} =~ /$t/ ) {
|
||||
$str = sprintf ("%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s\n",
|
||||
$str = sprintf ("%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s\n",
|
||||
$vm,
|
||||
$vms{$vm}{'name'},
|
||||
$vms{$vm}{'os'},
|
||||
@@ -162,6 +166,7 @@ foreach $t (keys %tag) {
|
||||
$vms{$vm}{'cores'},
|
||||
$vms{$vm}{'memory'},
|
||||
$vms{$vm}{'bootdisk'},
|
||||
$vms{$vm}{'nets'},
|
||||
$vms{$vm}{'description'},
|
||||
$vms{$vm}{'tags'},
|
||||
$vms{$vm}{'status'},
|
||||
|
||||
Reference in New Issue
Block a user