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
VMware Nagios xi Monitoring Wizard Illegal Division by Zero
-
- Posts: 55
- Joined: Wed Jan 16, 2013 4:44 pm
-
- Posts: 523
- Joined: Thu Oct 06, 2011 10:12 am
Re: VMware Nagios xi Monitoring Wizard Illegal Division by Z
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
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
-
- Posts: 55
- Joined: Wed Jan 16, 2013 4:44 pm
Re: VMware Nagios xi Monitoring Wizard Illegal Division by Z
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?
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?
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
Re: VMware Nagios xi Monitoring Wizard Illegal Division by Z
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?
Can you show us the full command you are using?
-
- Posts: 55
- Joined: Wed Jan 16, 2013 4:44 pm
Re: VMware Nagios xi Monitoring Wizard Illegal Division by Z
Here is the command from nagios.
[/size]
Here is the code from check_esx3.pl.
[/size]
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;;
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);
}
-
- Posts: 55
- Joined: Wed Jan 16, 2013 4:44 pm
Re: VMware Nagios xi Monitoring Wizard Illegal Division by Z
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.
-
- Red Shirt
- Posts: 8334
- Joined: Thu Nov 15, 2012 1:20 pm
Re: VMware Nagios xi Monitoring Wizard Illegal Division by Z
Code: Select all
my $value2 = simplify_number(convert_number($store->info->freeSpace) / convert_number($store->summary->capacity) * 100);
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
-
- Posts: 55
- Joined: Wed Jan 16, 2013 4:44 pm
Re: VMware Nagios xi Monitoring Wizard Illegal Division by Z
It can work from the command line.
-
- Posts: 55
- Joined: Wed Jan 16, 2013 4:44 pm
Re: VMware Nagios xi Monitoring Wizard Illegal Division by Z
It turns out a datastore was powered down and moved. I remapped the datastore in Vsphere and it worked just fine.
-
- Posts: 4380
- Joined: Mon Jun 14, 2010 10:21 am
Re: VMware Nagios xi Monitoring Wizard Illegal Division by Z
Thanks for the update!