[op5-users] [PATCH] Fixing issues when comparing strings in check_esx3.pl
Peter Östlin
peter.ostlin at op5.com
Wed Jun 10 09:01:55 CEST 2009
Thanks, I'll apply this patch shortly.
Odd that we have missed this though. If you browse the history you'll
see that this was introduced as a result of an optimization attempt.
If you look for stable code check out the tags named v2.x.x, tags
marked as beta are more likely to contain bugs. We welcome patches
against head of the master branch though.
As a side note, we will do some work on the plugins during the summer
and hopefully kill some bugs.
Peter Östlin
--
op5 AB
Första Långgatan 19
SE-413 27 Göteborg
Mob: +46 733-70 90 31
Fax: +46 31-774 04 32
http://www.op5.com
On Tue, Jun 9, 2009 at 10:22 PM, Eric Jonsson<eric at bitality.se> wrote:
> Fixing issues when comparing strings that broke command selection.
> Signed-off-by: Eric Jonsson <eric at bitality.se>
> ---
> diff --git a/check_esx3.pl b/check_esx3.pl
> index fba9887..f0cd707 100755
>
> --- a/check_esx3.pl
> +++ b/check_esx3.pl
> @@ -5,7 +5,7 @@
> # License: GPL
> # Copyright (c) 2008 op5 AB
> # Author: Kostyantyn Gushchyn <kgushtin at op5.com>
> -# Contributor(s): Patrick Müller, Jeremy Martin
> +# Contributor(s): Patrick Müller, Jeremy Martin, Eric Jonsson
> #
> # This program is free software; you can redistribute it and/or modify
> # it under the terms of the GNU General Public License version 2 as
> @@ -320,23 +320,23 @@ eval
>
> if (defined($vmname))
> {
> - if (uc($command) == "CPU")
> + if (uc($command) eq "CPU")
> {
> ($result, $output) = vm_cpu_info($vmname, $np, $subcommand);
> }
> - elsif (uc($command) == "MEM")
> + elsif (uc($command) eq "MEM")
> {
> ($result, $output) = vm_mem_info($vmname, $np, $subcommand);
> }
> - elsif (uc($command) == "NET")
> + elsif (uc($command) eq "NET")
> {
> ($result, $output) = vm_net_info($vmname, $np, $subcommand);
> }
> - elsif (uc($command) == "IO")
> + elsif (uc($command) eq "IO")
> {
> ($result, $output) = vm_disk_io_info($vmname, $np, $subcommand);
> }
> - elsif (uc($command) == "RUNTIME")
> + elsif (uc($command) eq "RUNTIME")
> {
> ($result, $output) = vm_runtime_info($vmname, $np, $subcommand);
> }
> @@ -350,31 +350,31 @@ eval
> {
> my $esx;
> $esx = {name => $host} if (defined($datacenter));
> - if (uc($command) == "CPU")
> + if (uc($command) eq "CPU")
> {
> ($result, $output) = host_cpu_info($esx, $np, $subcommand);
> }
> - elsif (uc($command) == "MEM")
> + elsif (uc($command) eq "MEM")
> {
> ($result, $output) = host_mem_info($esx, $np, $subcommand);
> }
> - elsif (uc($command) == "NET")
> + elsif (uc($command) eq "NET")
> {
> ($result, $output) = host_net_info($esx, $np, $subcommand);
> }
> - elsif (uc($command) == "IO")
> + elsif (uc($command) eq "IO")
> {
> ($result, $output) = host_disk_io_info($esx, $np, $subcommand);
> }
> - elsif (uc($command) == "VMFS")
> + elsif (uc($command) eq "VMFS")
> {
> ($result, $output) = host_list_vm_volumes_info($esx, $np, $subcommand,
> $percc || $percw);
> }
> - elsif (uc($command) == "RUNTIME")
> + elsif (uc($command) eq "RUNTIME")
> {
> ($result, $output) = host_runtime_info($esx, $np, $subcommand);
> }
> - elsif (uc($command) == "SERVICE")
> + elsif (uc($command) eq "SERVICE")
> {
> ($result, $output) = host_service_info($esx, $np, $subcommand);
> }
> @@ -386,33 +386,33 @@ eval
> }
> else
> {
> - if (uc($command) == "RECOMENDATIONS")
> + if (uc($command) eq "RECOMENDATIONS")
> {
> my $cluster_name;
> $cluster_name = {name => $subcommand} if (defined($subcommand));
> ($result, $output) = return_cluster_DRS_recomendations($np, $cluster_name);
> }
> - elsif (uc($command) == "CPU")
> + elsif (uc($command) eq "CPU")
> {
> ($result, $output) = dc_cpu_info($np, $subcommand);
> }
> - elsif (uc($command) == "MEM")
> + elsif (uc($command) eq "MEM")
> {
> ($result, $output) = dc_mem_info($np, $subcommand);
> }
> - elsif (uc($command) == "NET")
> + elsif (uc($command) eq "NET")
> {
> ($result, $output) = dc_net_info($np, $subcommand);
> }
> - elsif (uc($command) == "IO")
> + elsif (uc($command) eq "IO")
> {
> ($result, $output) = dc_disk_io_info($np, $subcommand);
> }
> - elsif (uc($command) == "VMFS")
> + elsif (uc($command) eq "VMFS")
> {
> ($result, $output) = dc_list_vm_volumes_info($np, $subcommand, $percc ||
> $percw);
> }
> - elsif (uc($command) == "RUNTIME")
> + elsif (uc($command) eq "RUNTIME")
> {
> ($result, $output) = dc_runtime_info($np, $subcommand);
> }
> @@ -563,7 +563,7 @@ sub host_cpu_info
>
> if (defined($subcommand))
> {
> - if (uc($subcommand) == "USAGE")
> + if (uc($subcommand) eq "USAGE")
> {
> $values = return_host_performance_values($host, 'cpu', ('usage.average'));
> if (defined($values))
> @@ -574,7 +574,7 @@ sub host_cpu_info
> $res = $np->check_threshold(check => $value);
> }
> }
> - elsif (uc($subcommand) == "USAGEMHZ")
> + elsif (uc($subcommand) eq "USAGEMHZ")
> {
> $values = return_host_performance_values($host, 'cpu',
> ('usagemhz.average'));
> if (defined($values))
> @@ -617,7 +617,7 @@ sub host_mem_info
>
> if (defined($subcommand))
> {
> - if (uc($subcommand) == "USAGE")
> + if (uc($subcommand) eq "USAGE")
> {
> $values = return_host_performance_values($host, 'mem', ('usage.average'));
> if (defined($values))
> @@ -628,7 +628,7 @@ sub host_mem_info
> $res = $np->check_threshold(check => $value);
> }
> }
> - elsif (uc($subcommand) == "USAGEMB")
> + elsif (uc($subcommand) eq "USAGEMB")
> {
> $values = return_host_performance_values($host, 'mem',
> ('consumed.average'));
> if (defined($values))
> @@ -639,7 +639,7 @@ sub host_mem_info
> $res = $np->check_threshold(check => $value);
> }
> }
> - elsif (uc($subcommand) == "SWAP")
> + elsif (uc($subcommand) eq "SWAP")
> {
> $values = return_host_performance_values($host, 'mem',
> ('swapused.average'));
> if (defined($values))
> @@ -650,7 +650,7 @@ sub host_mem_info
> $res = $np->check_threshold(check => $value);
> }
> }
> - elsif (uc($subcommand) == "OVERHEAD")
> + elsif (uc($subcommand) eq "OVERHEAD")
> {
> $values = return_host_performance_values($host, 'mem',
> ('overhead.average'));
> if (defined($values))
> @@ -661,7 +661,7 @@ sub host_mem_info
> $res = $np->check_threshold(check => $value);
> }
> }
> - elsif (uc($subcommand) == "OVERALL")
> + elsif (uc($subcommand) eq "OVERALL")
> {
> $values = return_host_performance_values($host, 'mem', ('consumed.average',
> 'overhead.average'));
> if (defined($values))
> @@ -708,7 +708,7 @@ sub host_net_info
>
> if (defined($subcommand))
> {
> - if (uc($subcommand) == "USAGE")
> + if (uc($subcommand) eq "USAGE")
> {
> $values = return_host_performance_values($host, 'net', ('usage.average:*'));
> if (defined($values))
> @@ -719,7 +719,7 @@ sub host_net_info
> $res = $np->check_threshold(check => $value);
> }
> }
> - elsif (uc($subcommand) == "RECEIVE")
> + elsif (uc($subcommand) eq "RECEIVE")
> {
> $values = return_host_performance_values($host, 'net',
> ('received.average:*'));
> if (defined($values))
> @@ -730,7 +730,7 @@ sub host_net_info
> $res = $np->check_threshold(check => $value);
> }
> }
> - elsif (uc($subcommand) == "SEND")
> + elsif (uc($subcommand) eq "SEND")
> {
> $values = return_host_performance_values($host, 'net',
> ('transmitted.average:*'));
> if (defined($values))
> @@ -741,7 +741,7 @@ sub host_net_info
> $res = $np->check_threshold(check => $value);
> }
> }
> - elsif (uc($subcommand) == "NIC")
> + elsif (uc($subcommand) eq "NIC")
> {
> my $host_view = Vim::find_entity_view(view_type => 'HostSystem', filter =>
> $host);
> die "Host \"" . $$host{"name"} . "\" does not exist\n" if
> (!defined($host_view));
> @@ -874,7 +874,7 @@ sub host_disk_io_info
>
> if (defined($subcommand))
> {
> - if (uc($subcommand) == "ABORTED")
> + if (uc($subcommand) eq "ABORTED")
> {
> $values = return_host_performance_values($host, 'disk',
> ('commandsAborted.summation:*'));
> if (defined($values))
> @@ -885,7 +885,7 @@ sub host_disk_io_info
> $res = $np->check_threshold(check => $value);
> }
> }
> - elsif (uc($subcommand) == "RESETS")
> + elsif (uc($subcommand) eq "RESETS")
> {
> $values = return_host_performance_values($host, 'disk',
> ('busResets.summation:*'));
> if (defined($values))
> @@ -896,7 +896,7 @@ sub host_disk_io_info
> $res = $np->check_threshold(check => $value);
> }
> }
> - elsif (uc($subcommand) == "READ")
> + elsif (uc($subcommand) eq "READ")
> {
> $values = return_host_performance_values($host, 'disk',
> ('totalReadLatency.average:*'));
> if (defined($values))
> @@ -907,7 +907,7 @@ sub host_disk_io_info
> $res = $np->check_threshold(check => $value);
> }
> }
> - elsif (uc($subcommand) == "WRITE")
> + elsif (uc($subcommand) eq "WRITE")
> {
> $values = return_host_performance_values($host, 'disk',
> ('totalWriteLatency.average:*'));
> if (defined($values))
> @@ -918,7 +918,7 @@ sub host_disk_io_info
> $res = $np->check_threshold(check => $value);
> }
> }
> - elsif (uc($subcommand) == "KERNEL")
> + elsif (uc($subcommand) eq "KERNEL")
> {
> $values = return_host_performance_values($host, 'disk',
> ('kernelLatency.average:*'));
> if (defined($values))
> @@ -929,7 +929,7 @@ sub host_disk_io_info
> $res = $np->check_threshold(check => $value);
> }
> }
> - elsif (uc($subcommand) == "DEVICE")
> + elsif (uc($subcommand) eq "DEVICE")
> {
> $values = return_host_performance_values($host, 'disk',
> ('deviceLatency.average:*'));
> if (defined($values))
> @@ -940,7 +940,7 @@ sub host_disk_io_info
> $res = $np->check_threshold(check => $value);
> }
> }
> - elsif (uc($subcommand) == "QUEUE")
> + elsif (uc($subcommand) eq "QUEUE")
> {
> $values = return_host_performance_values($host, 'disk',
> ('queueLatency.average:*'));
> if (defined($values))
> @@ -1063,12 +1063,12 @@ sub host_runtime_info
>
> if (defined($subcommand))
> {
> - if (uc($subcommand) == "CON")
> + if (uc($subcommand) eq "CON")
> {
> $output = "connection state=" . $runtime->connectionState->val;
> $res = 'OK' if ($runtime->connectionState->val eq "connected");
> }
> - elsif (uc($subcommand) == "HEALTH")
> + elsif (uc($subcommand) eq "HEALTH")
> {
> my $OKCount = 0;
> my $AlertCount = 0;
> @@ -1175,13 +1175,13 @@ sub host_runtime_info
> }
>
> }
> - elsif (uc($subcommand) == "MAINTENANCE")
> + elsif (uc($subcommand) eq "MAINTENANCE")
> {
> my %host_maintenance_state = (0 => "no", 1 => "yes");
> $output = "maintenance=" .
> $host_maintenance_state{$runtime->inMaintenanceMode};
> $res = 'OK';
> }
> - elsif (uc($subcommand) == "LIST")
> + elsif (uc($subcommand) eq "LIST")
> {
> my %vm_state_strings = ("poweredOn" => "UP", "poweredOff" => "DOWN",
> "suspended" => "SUSPENDED");
> my $vm_views = Vim::find_entity_views(view_type => 'VirtualMachine',
> begin_entity => $host_view);
> @@ -1203,12 +1203,12 @@ sub host_runtime_info
> $np->add_perfdata(label => "vmcount", value => $up, uom => 'units',
> threshold => $np->threshold);
> $res = $np->check_threshold(check => $up) if (defined($np->threshold));
> }
> - elsif (uc($subcommand) == "STATUS")
> + elsif (uc($subcommand) eq "STATUS")
> {
> $output = "overall status=" . $host_view->overallStatus->val;
> $res = 'OK' if ($host_view->overallStatus->val eq "green");
> }
> - elsif (uc($subcommand) == "ISSUES")
> + elsif (uc($subcommand) eq "ISSUES")
> {
> my $issues = $host_view->configIssue;
>
> @@ -1389,7 +1389,7 @@ sub vm_cpu_info
>
> if (defined($subcommand))
> {
> - if (uc($subcommand) == "USAGE")
> + if (uc($subcommand) eq "USAGE")
> {
> $values = return_host_vmware_performance_values($vmname, 'cpu',
> ('usage.average'));
> if (defined($values))
> @@ -1400,7 +1400,7 @@ sub vm_cpu_info
> $res = $np->check_threshold(check => $value);
> }
> }
> - elsif (uc($subcommand) == "USAGEMHZ")
> + elsif (uc($subcommand) eq "USAGEMHZ")
> {
> $values = return_host_vmware_performance_values($vmname, 'cpu',
> ('usagemhz.average'));
> if (defined($values))
> @@ -1411,7 +1411,7 @@ sub vm_cpu_info
> $res = $np->check_threshold(check => $value);
> }
> }
> - elsif (uc($subcommand) == "WAIT")
> + elsif (uc($subcommand) eq "WAIT")
> {
> $values = return_host_vmware_performance_values($vmname, 'cpu',
> ('wait.summation:*'));
> if (defined($values))
> @@ -1456,7 +1456,7 @@ sub vm_mem_info
>
> if (defined($subcommand))
> {
> - if (uc($subcommand) == "USAGE")
> + if (uc($subcommand) eq "USAGE")
> {
> $values = return_host_vmware_performance_values($vmname, 'mem',
> ('usage.average'));
> if (defined($values))
> @@ -1467,7 +1467,7 @@ sub vm_mem_info
> $res = $np->check_threshold(check => $value);
> }
> }
> - elsif (uc($subcommand) == "USAGEMB")
> + elsif (uc($subcommand) eq "USAGEMB")
> {
> $values = return_host_vmware_performance_values($vmname, 'mem',
> ('consumed.average'));
> if (defined($values))
> @@ -1478,7 +1478,7 @@ sub vm_mem_info
> $res = $np->check_threshold(check => $value);
> }
> }
> - elsif (uc($subcommand) == "SWAP")
> + elsif (uc($subcommand) eq "SWAP")
> {
> $values = return_host_vmware_performance_values($vmname, 'mem',
> ('swapped.average'));
> if (defined($values))
> @@ -1489,7 +1489,7 @@ sub vm_mem_info
> $res = $np->check_threshold(check => $value);
> }
> }
> - elsif (uc($subcommand) == "SWAPIN")
> + elsif (uc($subcommand) eq "SWAPIN")
> {
> $values = return_host_vmware_performance_values($vmname, 'mem',
> ('swapin.average'));
> if (defined($values))
> @@ -1500,7 +1500,7 @@ sub vm_mem_info
> $res = $np->check_threshold(check => $value);
> }
> }
> - elsif (uc($subcommand) == "SWAPOUT")
> + elsif (uc($subcommand) eq "SWAPOUT")
> {
> $values = return_host_vmware_performance_values($vmname, 'mem',
> ('swapout.average'));
> if (defined($values))
> @@ -1511,7 +1511,7 @@ sub vm_mem_info
> $res = $np->check_threshold(check => $value);
> }
> }
> - elsif (uc($subcommand) == "OVERHEAD")
> + elsif (uc($subcommand) eq "OVERHEAD")
> {
> $values = return_host_vmware_performance_values($vmname, 'mem',
> ('overhead.average'));
> if (defined($values))
> @@ -1522,7 +1522,7 @@ sub vm_mem_info
> $res = $np->check_threshold(check => $value);
> }
> }
> - elsif (uc($subcommand) == "OVERALL")
> + elsif (uc($subcommand) eq "OVERALL")
> {
> $values = return_host_vmware_performance_values($vmname, 'mem',
> ('consumed.average', 'overhead.average'));
> if (defined($values))
> @@ -1533,7 +1533,7 @@ sub vm_mem_info
> $res = $np->check_threshold(check => $value);
> }
> }
> - elsif (uc($subcommand) == "ACTIVE")
> + elsif (uc($subcommand) eq "ACTIVE")
> {
> $values = return_host_vmware_performance_values($vmname, 'mem',
> ('active.average'));
> if (defined($values))
> @@ -1584,7 +1584,7 @@ sub vm_net_info
>
> if (defined($subcommand))
> {
> - if (uc($subcommand) == "USAGE")
> + if (uc($subcommand) eq "USAGE")
> {
> $values = return_host_vmware_performance_values($vmname, 'net',
> ('usage.average:*'));
> if (defined($values))
> @@ -1595,7 +1595,7 @@ sub vm_net_info
> $res = $np->check_threshold(check => $value);
> }
> }
> - elsif (uc($subcommand) == "RECEIVE")
> + elsif (uc($subcommand) eq "RECEIVE")
> {
> $values = return_host_vmware_performance_values($vmname, 'net',
> ('received.average:*'));
> if (defined($values))
> @@ -1606,7 +1606,7 @@ sub vm_net_info
> $res = $np->check_threshold(check => $value);
> }
> }
> - elsif (uc($subcommand) == "SEND")
> + elsif (uc($subcommand) eq "SEND")
> {
> $values = return_host_vmware_performance_values($vmname, 'net',
> ('transmitted.average:*'));
> if (defined($values))
> @@ -1649,7 +1649,7 @@ sub vm_disk_io_info
>
> if (defined($subcommand))
> {
> - if (uc($subcommand) == "USAGE")
> + if (uc($subcommand) eq "USAGE")
> {
> $values = return_host_vmware_performance_values($vmname, 'disk',
> ('usage.average:*'));
> if (defined($values))
> @@ -1660,7 +1660,7 @@ sub vm_disk_io_info
> $res = $np->check_threshold(check => $value);
> }
> }
> - elsif (uc($subcommand) == "READ")
> + elsif (uc($subcommand) eq "READ")
> {
> $values = return_host_vmware_performance_values($vmname, 'disk',
> ('read.average:*'));
> if (defined($values))
> @@ -1671,7 +1671,7 @@ sub vm_disk_io_info
> $res = $np->check_threshold(check => $value);
> }
> }
> - elsif (uc($subcommand) == "WRITE")
> + elsif (uc($subcommand) eq "WRITE")
> {
> $values = return_host_vmware_performance_values($vmname, 'disk',
> ('write.average:*'));
> if (defined($values))
> @@ -1721,50 +1721,50 @@ sub vm_runtime_info
>
> if (defined($subcommand))
> {
> - if (uc($subcommand) == "CON")
> + if (uc($subcommand) eq "CON")
> {
> $output = "\"$vmname\" connection state=" . $runtime->connectionState->val;
> $res = 'OK' if ($runtime->connectionState->val eq "connected");
> }
> - elsif (uc($subcommand) == "CPU")
> + elsif (uc($subcommand) eq "CPU")
> {
> $output = "\"$vmname\" max cpu=" . $runtime->maxCpuUsage . " MHz";
> $res = 'OK';
> }
> - elsif (uc($subcommand) == "MEM")
> + elsif (uc($subcommand) eq "MEM")
> {
> $output = "\"$vmname\" max mem=" . $runtime->maxMemoryUsage . " MB";
> $res = 'OK';
> }
> - elsif (uc($subcommand) == "STATE")
> + elsif (uc($subcommand) eq "STATE")
> {
> my %vm_state_strings = ("poweredOn" => "UP", "poweredOff" => "DOWN",
> "suspended" => "SUSPENDED");
> $output = "\"$vmname\" run state=" .
> $vm_state_strings{$runtime->powerState->val};
> $res = 'OK' if ($runtime->powerState->val eq "poweredOn");
> }
> - elsif (uc($subcommand) == "STATUS")
> + elsif (uc($subcommand) eq "STATUS")
> {
> $output = "\"$vmname\" overall status=" . $vm_view->overallStatus->val;
> $res = 'OK' if ($vm_view->overallStatus->val eq "green");
> }
> - elsif (uc($subcommand) == "CONSOLECONNECTIONS")
> + elsif (uc($subcommand) eq "CONSOLECONNECTIONS")
> {
> $output = "\"$vmname\" console connections=" . $runtime->numMksConnections;
> $res = $np->check_threshold(check => $runtime->numMksConnections);
> }
> - elsif (uc($subcommand) == "GUEST")
> + elsif (uc($subcommand) eq "GUEST")
> {
> my %vm_guest_state = ("running" => "Running", "notRunning" => "Not running",
> "shuttingDown" => "Shutting down", "resetting" => "Resetting", "standby" =>
> "Standby", "unknown" => "Unknown");
> $output = "\"$vmname\" guest state=" .
> $vm_guest_state{$vm_view->guest->guestState};
> $res = 'OK' if ($vm_view->guest->guestState eq "running");
> }
> - elsif (uc($subcommand) == "TOOLS")
> + elsif (uc($subcommand) eq "TOOLS")
> {
> my %vm_tools_status = ("toolsNotInstalled" => "Not installed",
> "toolsNotRunning" => "Not running", "toolsOk" => "OK", "toolsOld" => "Old");
> $output = "\"$vmname\" tools status=" .
> $vm_tools_status{$vm_view->guest->toolsStatus->val};
> $res = 'OK' if ($vm_view->guest->toolsStatus->val eq "toolsOk");
> }
> - elsif (uc($subcommand) == "ISSUES")
> + elsif (uc($subcommand) eq "ISSUES")
> {
> my $issues = $vm_view->configIssue;
>
> @@ -1868,7 +1868,7 @@ sub dc_cpu_info
>
> if (defined($subcommand))
> {
> - if (uc($subcommand) == "USAGE")
> + if (uc($subcommand) eq "USAGE")
> {
> $values = return_dc_performance_values('cpu', ('usage.average'));
> if (defined($values))
> @@ -1881,7 +1881,7 @@ sub dc_cpu_info
> $res = $np->check_threshold(check => $value);
> }
> }
> - elsif (uc($subcommand) == "USAGEMHZ")
> + elsif (uc($subcommand) eq "USAGEMHZ")
> {
> $values = return_dc_performance_values('cpu', ('usagemhz.average'));
> if (defined($values))
> @@ -1930,7 +1930,7 @@ sub dc_mem_info
>
> if (defined($subcommand))
> {
> - if (uc($subcommand) == "USAGE")
> + if (uc($subcommand) eq "USAGE")
> {
> $values = return_dc_performance_values('mem', ('usage.average'));
> if (defined($values))
> @@ -1943,7 +1943,7 @@ sub dc_mem_info
> $res = $np->check_threshold(check => $value);
> }
> }
> - elsif (uc($subcommand) == "USAGEMB")
> + elsif (uc($subcommand) eq "USAGEMB")
> {
> $values = return_dc_performance_values('mem', ('consumed.average'));
> if (defined($values))
> @@ -1956,7 +1956,7 @@ sub dc_mem_info
> $res = $np->check_threshold(check => $value);
> }
> }
> - elsif (uc($subcommand) == "SWAP")
> + elsif (uc($subcommand) eq "SWAP")
> {
> $values = return_dc_performance_values('mem', ('swapused.average'));
> if (defined($values))
> @@ -1969,7 +1969,7 @@ sub dc_mem_info
> $res = $np->check_threshold(check => $value);
> }
> }
> - elsif (uc($subcommand) == "OVERHEAD")
> + elsif (uc($subcommand) eq "OVERHEAD")
> {
> $values = return_dc_performance_values('mem', ('overhead.average'));
> if (defined($values))
> @@ -1982,7 +1982,7 @@ sub dc_mem_info
> $res = $np->check_threshold(check => $value);
> }
> }
> - elsif (uc($subcommand) == "OVERALL")
> + elsif (uc($subcommand) eq "OVERALL")
> {
> $values = return_dc_performance_values('mem', ('consumed.average',
> 'overhead.average'));
> if (defined($values))
> @@ -2039,7 +2039,7 @@ sub dc_net_info
>
> if (defined($subcommand))
> {
> - if (uc($subcommand) == "USAGE")
> + if (uc($subcommand) eq "USAGE")
> {
> $values = return_dc_performance_values('net', ('usage.average:*'));
> if (defined($values))
> @@ -2052,7 +2052,7 @@ sub dc_net_info
> $res = $np->check_threshold(check => $value);
> }
> }
> - elsif (uc($subcommand) == "RECEIVE")
> + elsif (uc($subcommand) eq "RECEIVE")
> {
> $values = return_dc_performance_values('net', ('received.average:*'));
> if (defined($values))
> @@ -2065,7 +2065,7 @@ sub dc_net_info
> $res = $np->check_threshold(check => $value);
> }
> }
> - elsif (uc($subcommand) == "SEND")
> + elsif (uc($subcommand) eq "SEND")
> {
> $values = return_dc_performance_values('net', ('transmitted.average:*'));
> if (defined($values))
> @@ -2182,7 +2182,7 @@ sub dc_disk_io_info
>
> if (defined($subcommand))
> {
> - if (uc($subcommand) == "ABORTED")
> + if (uc($subcommand) eq "ABORTED")
> {
> $values = return_dc_performance_values('disk',
> ('commandsAborted.summation:*'));
> if (defined($values))
> @@ -2195,7 +2195,7 @@ sub dc_disk_io_info
> $res = $np->check_threshold(check => $value);
> }
> }
> - elsif (uc($subcommand) == "RESETS")
> + elsif (uc($subcommand) eq "RESETS")
> {
> $values = return_dc_performance_values('disk', ('busResets.summation:*'));
> if (defined($values))
> @@ -2208,7 +2208,7 @@ sub dc_disk_io_info
> $res = $np->check_threshold(check => $value);
> }
> }
> - elsif (uc($subcommand) == "READ")
> + elsif (uc($subcommand) eq "READ")
> {
> $values = return_dc_performance_values('disk',
> ('totalReadLatency.average:*'));
> if (defined($values))
> @@ -2221,7 +2221,7 @@ sub dc_disk_io_info
> $res = $np->check_threshold(check => $value);
> }
> }
> - elsif (uc($subcommand) == "WRITE")
> + elsif (uc($subcommand) eq "WRITE")
> {
> $values = return_dc_performance_values('disk',
> ('totalWriteLatency.average:*'));
> if (defined($values))
> @@ -2234,7 +2234,7 @@ sub dc_disk_io_info
> $res = $np->check_threshold(check => $value);
> }
> }
> - elsif (uc($subcommand) == "KERNEL")
> + elsif (uc($subcommand) eq "KERNEL")
> {
> $values = return_dc_performance_values('disk', ('kernelLatency.average:*'));
> if (defined($values))
> @@ -2247,7 +2247,7 @@ sub dc_disk_io_info
> $res = $np->check_threshold(check => $value);
> }
> }
> - elsif (uc($subcommand) == "DEVICE")
> + elsif (uc($subcommand) eq "DEVICE")
> {
> $values = return_dc_performance_values('disk', ('deviceLatency.average:*'));
> if (defined($values))
> @@ -2260,7 +2260,7 @@ sub dc_disk_io_info
> $res = $np->check_threshold(check => $value);
> }
> }
> - elsif (uc($subcommand) == "QUEUE")
> + elsif (uc($subcommand) eq "QUEUE")
> {
> $values = return_dc_performance_values('disk', ('queueLatency.average:*'));
> if (defined($values))
> @@ -2332,7 +2332,7 @@ sub dc_runtime_info
>
> if (defined($subcommand))
> {
> - if (uc($subcommand) == "LIST")
> + if (uc($subcommand) eq "LIST")
> {
> my %vm_state_strings = ("poweredOn" => "UP", "poweredOff" => "DOWN",
> "suspended" => "SUSPENDED");
> my $vm_views = Vim::find_entity_views(view_type => 'VirtualMachine');
> @@ -2354,12 +2354,12 @@ sub dc_runtime_info
> $np->add_perfdata(label => "vmcount", value => $up, uom => 'units',
> threshold => $np->threshold);
> $res = $np->check_threshold(check => $up) if (defined($np->threshold));
> }
> - elsif (uc($subcommand) == "STATUS")
> + elsif (uc($subcommand) eq "STATUS")
> {
> $output = "overall status=" . $dc_view->overallStatus->val;
> $res = 'OK' if ($dc_view->overallStatus->val eq "green");
> }
> - elsif (uc($subcommand) == "ISSUES")
> + elsif (uc($subcommand) eq "ISSUES")
> {
> my $issues = $dc_view->configIssue;
>
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
> _______________________________________________
> op5-users mailing list
> op5-users at lists.op5.com
> http://lists.op5.com/mailman/listinfo/op5-users
>
>
More information about the op5-users
mailing list