Page 1 of 1

VMware Nagios XI Monitoring Wizard Illegal Division by Zero

Posted: Wed Jan 16, 2013 6:00 pm
by samuel
Why is nagios doing this? I have been running the datastore service for a month or two now. I have had no problems with this and then this pops up out of the blue on 3 of 5 vsphere servers. All three of the services went critical at the same time. On two different nagios servers. I haven't done anything on the vsphere servers and when it happened i wasn't even working on the nagios server. Do you know what versions of vsphere are supported in VMware Naigos XI Monitoring Wizard?

The Error is "DataStore" usage for VMHost service:"ESX3 Critical-Illegal Division by zero at /usr/local/nagios/libexec/check_esx3.pl line 106

The line 1065 is "my $value2 = simplify_number(convert_number($store->info->freeSpace) / convert_number($store->summary->capacity) * 100);"


What version of Nagios XI are you using? Nagios XI 2012R1.3
Linux Distribution and version? centos 6.3
32 or 64bit? 32bit
VMware Image or Manual Install of XI? VMware Image
Are there specials configurations on your system, ie; is Gnome installed? Are you using a proxy? Are you using SSL? none

Re: VMware Nagios XI Monitoring Wizard Illegal Division by Z

Posted: Thu Jan 17, 2013 10:35 am
by yancy
samuel,

It sounds like the datastore may still contain reference to a drive that no longer exists.

Which version are you running of check_esx3 ?

#line 97
$VERSION = '0.5.0';

regards,

-Yancy

Re: VMware Nagios XI Monitoring Wizard Illegal Division by Z

Posted: Thu Jan 17, 2013 12:57 pm
by samuel
Yancy,

I have $VERSION = '0.2.0';

Is it because I have an out of date version of the file?
Where would i find an updated verison?
And is there any way to check to see if plugins are out of date; other than going through each individual file looking for the version?

Re: VMware Nagios XI Monitoring Wizard Illegal Division by Z

Posted: Thu Jan 17, 2013 6:00 pm
by scottwilkerson
I doubt this is version specific, I would bet that it has something to do with the datastore not existing or likely has special characters that need to be escaped.

Can you show us the full command you are using?

Re: VMware Nagios XI Monitoring Wizard Illegal Division by Z

Posted: Fri Jan 18, 2013 9:35 am
by samuel
Here is the command from nagios.

Code: Select all

COMMAND: /usr/local/nagios/libexec/check_esx3.pl -H "10.150.150.51" -f "/usr/local/nagiosxi/etc/components/vmware/csesxi01_auth.txt" -l "VMFS"
OUTPUT: ESX3 CRITICAL - Illegal division by zero at /usr/local/nagios/libexec/check_esx3.pl line 1065. | datastore1=4099123.00MB;;
[/size]


Here is the code from check_esx3.pl.

Code: Select all

sub host_list_vm_volumes_info
{
        my ($host, $np, $subcommand, $perc) = @_;

        my $res = 'CRITICAL';
        my $output = 'HOST VM VOLUMES Unknown error';

        if (defined($subcommand))
        {
                $output = "No volume named \"$subcommand\" found";
                my $host_view = Vim::find_entity_view(view_type => 'HostSystem', filter => $host, properties => ['name', 'datastore']);
                foreach my $ref_store (@{$host_view->datastore})
                {
                        my $store = Vim::get_view(mo_ref => $ref_store, properties => ['summary', 'info']);
                        if ($store->summary->name eq $subcommand)
                        {
                                $res = 'OK';
                                my $value1 = simplify_number(convert_number($store->summary->freeSpace) / 1024 / 1024);
                                my $value2 = simplify_number(convert_number($store->info->freeSpace) / convert_number($store->summary->capacity) * 100);
                                if ($perc)
                                {
                                        $res = $np->check_threshold(check => $value2);
                                }
                                else
                                {
                                        $res = $np->check_threshold(check => $value1);
                                }
                                $np->add_perfdata(label => $store->summary->name, value => $perc?$value2:$value1, uom => $perc?'%':'MB', threshold => $np->threshold);
                                $output = $store->summary->name . "=". $value1 . " MB (" . $value2 . "%)";
                        }
                }
        }
        else
        {
                $res = 0;
                $output = '';
                my $host_view = Vim::find_entity_view(view_type => 'HostSystem', filter => $host, properties => ['name', 'datastore']);
                foreach my $ref_store (@{$host_view->datastore})
                {
                        my $store = Vim::get_view(mo_ref => $ref_store, properties => ['summary', 'info']);
                        my $value1 = simplify_number(convert_number($store->summary->freeSpace) / 1024 / 1024);
                        my $value2 = simplify_number(convert_number($store->info->freeSpace) / convert_number($store->summary->capacity) * 100);
                        if (!$res)
                        {
                                if ($perc)
                                {
                                        $res = $np->check_threshold(check => $value2);
                                }
                                else
                                {
                                        $res = $np->check_threshold(check => $value1);
                                }
                        }
                        $np->add_perfdata(label => $store->summary->name, value => $perc?$value2:$value1, uom => $perc?'%':'MB', threshold => $np->threshold);
                        $output .= $store->summary->name . "=". $value1 . " MB (" . $value2 . "%), ";
                }

                chop($output);
                chop($output);
                $output = "storages : " . $output;
        }

        return ($res, $output);
}
[/size]

Re: VMware Nagios XI Monitoring Wizard Illegal Division by Z

Posted: Fri Jan 18, 2013 10:24 am
by samuel
I also noticed that the servers that have this error are the servers that have versions 5.0, 5.0.1, and 5.1. The servers that are still working are 4.1 servers. What is weird is that the 5.* servers were working before with no problems, and then three servers, at different locations in the U.S., started outputting the error at the exact same time.

Re: VMware Nagios XI Monitoring Wizard Illegal Division by Z

Posted: Fri Jan 18, 2013 4:12 pm
by abrist

Code: Select all

my $value2 = simplify_number(convert_number($store->info->freeSpace) / convert_number($store->summary->capacity) * 100);
convert_number($store->summary->capacity) is resulting in zero. This would imply that the datastore is of size 0 or missing. Does the check work directly from the command line?

Re: VMware Nagios XI Monitoring Wizard Illegal Division by Z

Posted: Fri Jan 18, 2013 4:42 pm
by samuel
It can work from the command line.

Re: VMware Nagios XI Monitoring Wizard Illegal Division by Z

Posted: Sun Jan 20, 2013 10:43 pm
by samuel
It turns out a datastore was powered down and moved. I remapped the datastore in Vsphere and it worked just fine.

Re: VMware Nagios XI Monitoring Wizard Illegal Division by Z

Posted: Mon Jan 21, 2013 10:51 am
by mguthrie
Thanks for the update!