[ SEA-GHOST MINI SHELL]
#!/usr/bin/perl
use strict;
use warnings;
my @IDs = `qm list | grep -v VMID | awk '{print \$1}'`;
chomp @IDs;
my @SERVERS = ();
for my $i (@IDs) {
my $server_status = `pvesh get /nodes/\$(echo -n \$(hostname -s))/qemu/$i/status/current 2>/dev/null | grep "\\"status\\"" | awk -F'"' '{print \$4}'`;
chomp $server_status;
my $result_string = `pvesh create /nodes/\$(echo -n \$(hostname -s))/qemu/$i/monitor -command "info balloon" 2> /dev/null`;
chomp $result_string;
if ($result_string !~ /total_mem=/ and $server_status ne 'stopped') {
my $server = `pvesh get /nodes/\$(echo -n \$(hostname -s))/qemu/$i/config 2>/dev/null | grep name | awk -F'"' '{print \$4}'`;
chomp $server;
push (@SERVERS, $server);
}
}
if (@SERVERS) {
print "ERROR: Found missing virtio-balloon driver: ";
print join(", ", @SERVERS) . "\n";
} else {
print "OK";
}
SEA-GHOST - SHELL CODING BY SEA-GHOST