488
488
# - host_net_info.pm -> host_net_info()
489
489
# - host_disk_io_info.pm -> host_disk_io_info()
490
490
# - datastore_volumes_info.pm -> datastore_volumes_info()
491
- # - host_list_vm_volumes_info .pm -> host_list_vm_volumes_info ()
491
+ # - host_volumes_info .pm -> host_volumes_info ()
492
492
# - host_runtime_info.pm -> host_runtime_info()
493
493
# - host_service_info.pm -> host_service_info()
494
494
# - host_storage_info.pm -> host_storage_info()
1395
1395
# - 26 Nov 2019 M.Fuerstenau version 1.2.3
1396
1396
# - Fixed duplicate definition in datastore_volumes_info.pm
1397
1397
#
1398
- # - 9 Jun 2022 M.Fuerstenau version 1.2.4
1398
+ # - 3 Jun 2022 M.Fuerstenau version 1.2.4
1399
1399
# - Added several patches (pull requests) from Github:
1400
1400
# - new command line option "--moref" that allows for selecting virtual
1401
1401
# machines by their Managed Object Reference name (e.g. "vm-193")
1414
1414
# is printed
1415
1415
# - Remove output of guestToolsUnmanaged if --open_vm_tools_ok
1416
1416
# - Fully ignore unknown states for hardware
1417
-
1417
+ #
1418
+ # - 04 Auf 2022 M.Fuerstenau version 1.2.5
1419
+ # - Renamed module host_list_vm_volumes_info to host_volumes_info
1420
+ # because name was misleading
1421
+ # - Minor corrections in help.pm
1422
+ # - New option --show-storage for runtime->listvms via host ore DC
1423
+ # - Fixed bug in blacklist/whitelist. Was casesensitve by default. This leads
1424
+ # to problems if for example a VM is defined in ESX with uppercase letters
1425
+ # and check is with lowercase (MYSERVER vs. myserver). So for example
1426
+ # checking for snapshots may result in no old snapshots found while
1427
+ # there are some. Fixed by adding option --ignore_casesensitive.
1428
+ #
1418
1429
1419
1430
1420
1431
use strict;
@@ -1466,7 +1477,7 @@ BEGIN
1466
1477
1467
1478
# General stuff
1468
1479
our $version ; # Only for showing the version
1469
- our $prog_version = ' 1.2.4 ' ; # Contains the program version number
1480
+ our $prog_version = ' 1.2.5 ' ; # Contains the program version number
1470
1481
our $ProgName = basename($0 );
1471
1482
1472
1483
my $PID = $$ ; # Stores the process identifier of the actual run. This will be
@@ -1557,6 +1568,7 @@ BEGIN
1557
1568
1558
1569
our $blacklist ; # Contains the blacklist
1559
1570
our $whitelist ; # Contains the whitelist
1571
+ our $ignore_casesensitive ; # Option to handle blacklist/whitelist case insensitive
1560
1572
1561
1573
our $isregexp ; # treat names, blacklist and whitelists as regexp
1562
1574
@@ -1599,9 +1611,9 @@ BEGIN
1599
1611
# set this default to "n".
1600
1612
my $statelabels ; # To overwrite $statelabels_def via commandline.
1601
1613
our $openvmtools ; # Signalize that you use Open VM Tools instead of the servers one.
1602
- our $no_vmtools ; # Signalize that not having VMware tools is ok
1614
+ our $no_vmtools ; # Signalize that not having VMware tools is ok
1603
1615
our $hidekey ; # Hide licenses key when requesting license informations
1604
-
1616
+ our $show_storage ; # Show storage shows storage used bei VM. Used in conjunction with listvms
1605
1617
1606
1618
1607
1619
my $trace ;
@@ -1646,11 +1658,13 @@ BEGIN
1646
1658
" nosession" => \$nosession ,
1647
1659
" B=s" => \$blacklist , " exclude=s" => \$blacklist ,
1648
1660
" W=s" => \$whitelist , " include=s" => \$whitelist ,
1661
+ " ignore_casesensitive" => \$ignore_casesensitive ,
1649
1662
" t=s" => \$timeout , " timeout=s" => \$timeout ,
1650
1663
" V" => \$version , " version" => \$version ,
1651
1664
" d" => \$debug , " debug" => \$debug ,
1652
1665
" ignore_unknown" => \$ignoreunknown ,
1653
1666
" ignore_warning" => \$ignorewarning ,
1667
+ " show-storage" => \$show_storage ,
1654
1668
" trace=s" => \$trace ,
1655
1669
" listsensors" => \$listsensors ,
1656
1670
" ignore_health" => \$ignorehealth ,
@@ -2291,7 +2305,7 @@ sub main_select
2291
2305
2292
2306
if (defined ($host ))
2293
2307
{
2294
- # The following if black is only needed if we check a ESX server via the
2308
+ # The following if block is only needed if we check a ESX server via the
2295
2309
# the datacenten (vsphere server) instead of doing it directly.
2296
2310
# Directly is better
2297
2311
@@ -2300,6 +2314,13 @@ sub main_select
2300
2314
{
2301
2315
$esx_server = {name => $host };
2302
2316
}
2317
+
2318
+ if (defined $show_storage )
2319
+ {
2320
+ require vm_storage_path;
2321
+ import vm_storage_path;
2322
+ }
2323
+
2303
2324
if ($select eq " cpu" )
2304
2325
{
2305
2326
require host_cpu_info;
@@ -2330,9 +2351,9 @@ sub main_select
2330
2351
}
2331
2352
if ($select eq " volumes" )
2332
2353
{
2333
- require host_list_vm_volumes_info ;
2334
- import host_list_vm_volumes_info ;
2335
- ($result , $output ) = host_list_vm_volumes_info ($esx_server , $maintenance_mode_state );
2354
+ require host_volumes_info ;
2355
+ import host_volumes_info ;
2356
+ ($result , $output ) = host_volumes_info ($esx_server , $maintenance_mode_state );
2336
2357
return ($result , $output );
2337
2358
}
2338
2359
if ($select eq " runtime" )
@@ -2702,19 +2723,38 @@ sub isblacklisted
2702
2723
return 0;
2703
2724
}
2704
2725
2726
+ # our $ignore_casesensitive; # Option to handle blacklist/whitelist case insensitive
2727
+
2705
2728
if ($regexpflag == 0)
2706
2729
{
2707
- $ret = grep (/ $candidate / , $$blacklist_ref );
2730
+ if (defined ($ignore_casesensitive ))
2731
+ {
2732
+ $ret = grep (/ $candidate /i , $$blacklist_ref );
2733
+ }
2734
+ else
2735
+ {
2736
+ $ret = grep (/ $candidate / , $$blacklist_ref );
2737
+ }
2708
2738
}
2709
2739
else
2710
2740
{
2711
2741
@blacklist = split (/ ,/ , $$blacklist_ref );
2712
2742
2713
2743
foreach $blacklist (@blacklist )
2714
2744
{
2715
- if ($candidate =~ m / $blacklist / )
2745
+ if (defined ( $ignore_casesensitive ) )
2716
2746
{
2717
- $hitcount ++;
2747
+ if ($candidate =~ m /$blacklist / i )
2748
+ {
2749
+ $hitcount ++;
2750
+ }
2751
+ }
2752
+ else
2753
+ {
2754
+ if ($candidate =~ m /$blacklist / )
2755
+ {
2756
+ $hitcount ++;
2757
+ }
2718
2758
}
2719
2759
}
2720
2760
@@ -2741,17 +2781,34 @@ sub isnotwhitelisted
2741
2781
2742
2782
if ($regexpflag == 0)
2743
2783
{
2744
- $ret = ! grep (/ $candidate / , $$whitelist_ref );
2784
+ if (defined ($ignore_casesensitive ))
2785
+ {
2786
+ $ret = ! grep (/ $candidate /i , $$whitelist_ref );
2787
+ }
2788
+ else
2789
+ {
2790
+ $ret = ! grep (/ $candidate / , $$whitelist_ref );
2791
+ }
2745
2792
}
2746
2793
else
2747
2794
{
2748
2795
@whitelist = split (/ ,/ , $$whitelist_ref );
2749
2796
2750
2797
foreach $whitelist (@whitelist )
2751
2798
{
2752
- if ($candidate =~ m /$whitelist / )
2799
+ if (defined ($ignore_casesensitive ))
2800
+ {
2801
+ if ($candidate =~ m /$whitelist / i )
2802
+ {
2803
+ $hitcount ++;
2804
+ }
2805
+ }
2806
+ else
2753
2807
{
2754
- $hitcount ++;
2808
+ if ($candidate =~ m /$whitelist / )
2809
+ {
2810
+ $hitcount ++;
2811
+ }
2755
2812
}
2756
2813
}
2757
2814
0 commit comments