ZEVENET Monitoring not returning Data

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
lpereira
Posts: 143
Joined: Thu Jul 27, 2017 4:23 pm

ZEVENET Monitoring not returning Data

Post by lpereira »

Hello all:
I'm trying to configure a few perl monitoring scrtipt for ZEVENET Load Balancer. According to their GitHub page i need to download a few packages, but they are not working from my end

their GitHub page is https://github.com/zevenet/zevenet-nagios-plugins

here is the errors i got trying to download the cpan packages:

Code: Select all

[root@nagios libexec]# perl -MCPAN -e 'install WWW::Curl'
CPAN: Storable loaded ok (v2.20)
CPAN: LWP::UserAgent loaded ok (v5.833)
CPAN: Time::HiRes loaded ok (v1.9721)
Warning: no success downloading '/root/.cpan/sources/authors/01mailrc.txt.gz.tmp101022'. Giving up on it. at /usr/share/perl5/CPAN/Index.pm line 225
Fetching with LWP:
  http://www.perl.org/CPAN/authors/01mailrc.txt.gz
LWP failed with code[500] message[Can't connect to www.perl.org:80 (Bad hostname 'www.perl.org')]

Trying with "/usr/bin/curl -L -f -s -S --netrc-optional" to get
    "http://www.perl.org/CPAN/authors/01mailrc.txt.gz"
curl: (6) Couldn't resolve host 'www.perl.org'

    Function system("/usr/bin/curl -L -f -s -S --netrc-optional "http://www.perl.org/CPAN/authors/01mailrc.txt.gz"  > /root/.cpan/sources/authors/01mailrc.txt.tmp101022")
    returned status 6 (wstat 1536)
Warning: expected file [/root/.cpan/sources/authors/01mailrc.txt.gz.tmp101022] doesn't exist

Trying with "/usr/bin/wget -O /root/.cpan/sources/authors/01mailrc.txt.tmp101022" to get
    "http://www.perl.org/CPAN/authors/01mailrc.txt.gz"
--2018-01-16 17:40:04--  http://www.perl.org/CPAN/authors/01mailrc.txt.gz
Resolving www.perl.org... failed: No address associated with hostname.
wget: unable to resolve host address âwww.perl.orgâ


    returned status 4 (wstat 1024)
Warning: expected file [/root/.cpan/sources/authors/01mailrc.txt.gz.tmp101022] doesn't exist
    Warning: no success downloading '/root/.cpan/sources/authors/01mailrc.txt.gz.tmp101022'. Giving up on it. at /usr/share/perl5/CPAN/Index.pm line 225
Fetching with LWP:
  ftp://ftp.perl.org/pub/CPAN/authors/01mailrc.txt.gz
LWP failed with code[500] message[LWP::Protocol::MyFTP: Bad hostname 'ftp.perl.org']
Fetching with Net::FTP:
  ftp://ftp.perl.org/pub/CPAN/authors/01mailrc.txt.gz
  Could not connect to host 'ftp.perl.org' with Net::FTP
Fetching with Net::FTP
  ftp://ftp.perl.org/pub/CPAN/authors/01mailrc.txt.gz.gz
  Could not connect to host 'ftp.perl.org' with Net::FTP

Trying with "/usr/bin/curl -L -f -s -S --netrc-optional" to get
    "ftp://ftp.perl.org/pub/CPAN/authors/01mailrc.txt.gz"
curl: (6) Couldn't resolve host 'ftp.perl.org'

    Function system("/usr/bin/curl -L -f -s -S --netrc-optional "ftp://ftp.perl.org/pub/CPAN/authors/01mailrc.txt.gz"  > /root/.cpan/sources/authors/01mailrc.txt.tmp101022")
    returned status 6 (wstat 1536)
Warning: expected file [/root/.cpan/sources/authors/01mailrc.txt.gz.tmp101022] doesn't exist

Trying with "/usr/bin/wget -O /root/.cpan/sources/authors/01mailrc.txt.tmp101022" to get
    "ftp://ftp.perl.org/pub/CPAN/authors/01mailrc.txt.gz"
--2018-01-16 17:40:09--  ftp://ftp.perl.org/pub/CPAN/authors/01mailrc.txt.gz
           => â/root/.cpan/sources/authors/01mailrc.txt.tmp101022â
esolving ftp.perl.org... failed: No address associated with hostname.
wget: unable to resolve host address âftp.perl.orgâ


    returned status 4 (wstat 1024)
Warning: expected file [/root/.cpan/sources/authors/01mailrc.txt.gz.tmp101022] doesn't exist
    Warning: no success downloading '/root/.cpan/sources/authors/01mailrc.txt.gz.tmp101022'. Giving up on it. at /usr/share/perl5/CPAN/Index.pm line 225
No external ftp command available

Your urllist is empty! The urllist can be edited. E.g. with 'o conf urllist
push ftp://myurl/'

Could not fetch authors/01mailrc.txt.gz

When i try to run the scrtip from CM i got the following error:

Code: Select all

perl check_zevenet_cpu.pl -H XXX.XXX.XXX.XXX -z 6DH2xE0yTiioiZrMyUpv0I  -w 20 -c 10
Can't locate WWW/Curl/Easy.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at check_zevenet_cpu.pl line 53.
BEGIN failed--compilation aborted at check_zevenet_cpu.pl line 53.
Can anyone please assist?

thanks in advance
lpereira
Posts: 143
Joined: Thu Jul 27, 2017 4:23 pm

Re: ZEVENET Monitoring not returning Data

Post by lpereira »

i had installed WWW:CURL, but i got the following error trying to check the status

Code: Select all

[root@nagios libexec]# perl check_zevenet_cpu.pl -H XXX.XXX.XXX.XXX -z 6DH2xE0yTiioiZrMyUpv -w 20 -c 10
Can't use an undefined value as filehandle reference at check_zevenet_cpu.pl line 179.
the line 179 contains the following

Code: Select all

# Starts the actual request
$retcode = $curl->perform;
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: ZEVENET Monitoring not returning Data

Post by npolovenko »

You might be missing some packages, I'd suggest installing the following packages on your system:

Code: Select all

libcurl-devel.x86_64 
libcurl.x86_64 
curl.x86_64 
libwww-curl-perl
libcurl-devel
Also, what is your operating system? Did you get the latest version of this plugin from the Github? Does the plugin run OK without any arguments, or does it still fail with the same error?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
lpereira
Posts: 143
Joined: Thu Jul 27, 2017 4:23 pm

Re: ZEVENET Monitoring not returning Data

Post by lpereira »

npolovenko wrote:You might be missing some packages, I'd suggest installing the following packages on your system:

Code: Select all

libcurl-devel.x86_64 
libcurl.x86_64 
curl.x86_64 
libwww-curl-perl
libcurl-devel
Also, what is your operating system? Did you get the latest version of this plugin from the Github? Does the plugin run OK without any arguments, or does it still fail with the same error?
Thanks for the response. I have installed the VM provided by Nagios. (CentOS release 6.9 (Final) )

the only package missing was libcurl-devel.x86_64 and the OS cannot find libwww-curl-perl

Code: Select all

[root@nagios libexec]# yum install libcurl-devel.x86_64
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
 * base: centos.brisanet.com.br
 * epel: mirror.upb.edu.co
 * extras: centos.brisanet.com.br
 * updates: centos.brisanet.com.br
Resolving Dependencies
--> Running transaction check
---> Package libcurl-devel.x86_64 0:7.19.7-53.el6_9 will be installed
--> Processing Dependency: libidn-devel for package: libcurl-devel-7.19.7-53.el6_9.x86_64
--> Running transaction check
---> Package libidn-devel.x86_64 0:1.18-2.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================================================================
 Package                                    Arch                                Version                                      Repository                            Size
========================================================================================================================================================================
Installing:
 libcurl-devel                              x86_64                              7.19.7-53.el6_9                              updates                              247 k
Installing for dependencies:
 libidn-devel                               x86_64                              1.18-2.el6                                   base                                 137 k

Transaction Summary
========================================================================================================================================================================
Install       2 Package(s)

Total download size: 384 k
Installed size: 889 k
Is this ok [y/N]: y
Downloading Packages:
(1/2): libcurl-devel-7.19.7-53.el6_9.x86_64.rpm                                                                                                  | 247 kB     00:00
(2/2): libidn-devel-1.18-2.el6.x86_64.rpm                                                                                                        | 137 kB     00:00
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                   199 kB/s | 384 kB     00:01
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : libidn-devel-1.18-2.el6.x86_64                                                                                                                       1/2
  Installing : libcurl-devel-7.19.7-53.el6_9.x86_64                                                                                                                 2/2
  Verifying  : libidn-devel-1.18-2.el6.x86_64                                                                                                                       1/2
  Verifying  : libcurl-devel-7.19.7-53.el6_9.x86_64                                                                                                                 2/2

Installed:
  libcurl-devel.x86_64 0:7.19.7-53.el6_9

Dependency Installed:
  libidn-devel.x86_64 0:1.18-2.el6

Complete!
[root@nagios libexec]# yum install libcurl.x86_64
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
 * base: centos.brisanet.com.br
 * epel: mirror.upb.edu.co
 * extras: centos.brisanet.com.br
 * updates: centos.brisanet.com.br
Package libcurl-7.19.7-53.el6_9.x86_64 already installed and latest version
Nothing to do
[root@nagios libexec]# yum install curl.x86_64
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
 * base: centos.brisanet.com.br
 * epel: mirror.upb.edu.co
 * extras: centos.brisanet.com.br
 * updates: centos.brisanet.com.br
Package curl-7.19.7-53.el6_9.x86_64 already installed and latest version
Nothing to do
[root@nagios libexec]# yum install libwww-curl-perl
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
 * base: centos.brisanet.com.br
 * epel: mirror.upb.edu.co
 * extras: centos.brisanet.com.br
 * updates: centos.brisanet.com.br
No package libwww-curl-perl available.
Error: Nothing to do
[root@nagios libexec]# yum install libcurl-devel
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
 * base: centos.brisanet.com.br
 * epel: mirror.upb.edu.co
 * extras: centos.brisanet.com.br
 * updates: centos.brisanet.com.br
Package libcurl-devel-7.19.7-53.el6_9.x86_64 already installed and latest version
Nothing to do
if i run the plugins without arguments it ask me to add them.

Code: Select all

[root@nagios libexec]# perl check_zevenet_swap.pl  -H hostip -z 6DH2xE0yTiioiZrMyUpv0I
Usage: check_zevenet_swap.pl [ -v|--verbose ]  [-H <host>] [-t <timeout>]
        [ -z|--zapikey=<Zevenet API v3 ZAPI_KEY> ]
    [ -c|--critical=<critical threshold> ]
    [ -w|--warning=<warning threshold> ]

User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: ZEVENET Monitoring not returning Data

Post by tgriep »

The package may be called perl-WWW-Curl so run this as root to install it and see if that fixes the issue.

Code: Select all

yum install perl-WWW-Curl -y
Be sure to check out our Knowledgebase for helpful articles and solutions!
lpereira
Posts: 143
Joined: Thu Jul 27, 2017 4:23 pm

Re: ZEVENET Monitoring not returning Data

Post by lpereira »

tgriep wrote:The package may be called perl-WWW-Curl so run this as root to install it and see if that fixes the issue.

Code: Select all

yum install perl-WWW-Curl -y
is already installed

Code: Select all

Package perl-WWW-Curl-4.09-4.el6.x86_64 already installed and latest version
Nothing to do

[root@nagios libexec]# perl check_zevenet_swap.pl  -H hostip -z 6DH2xE0yTiioiZrMyUpv0I2YP -c10 -w20
Can't use an undefined value as filehandle reference at check_zevenet_swap.pl line 178.

User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: ZEVENET Monitoring not returning Data

Post by tgriep »

I see that you have been posting at the author of the plugins web site and they just posted a possible fix to the plugin.
Try implementing the fix and see if that solves the issue for you.
Be sure to check out our Knowledgebase for helpful articles and solutions!
lpereira
Posts: 143
Joined: Thu Jul 27, 2017 4:23 pm

Re: ZEVENET Monitoring not returning Data

Post by lpereira »

according with the script owner, he cannot replicate the issue and from his side the script works fine. They are using a Debian Distro and i'm using the Centos VM provided by Nagios.


the curious thing is, running a curl -k i got response from the Balancer

Code: Select all

root@nagios libexec]# curl -k -X GET -H "ZAPI_KEY: KEY " https://hostip/zapi/v3/zapi.cgi/stats/system/cpu
{
"description" : "System CPU usage",
"params" : {
"cores" : 8,
"date" : "Fri Jan 19 07:30:08 2018",
"hostname" : "hostname",
"idle" : 99.62,
"iowait" : 0,
"irq" : 0,
"nice" : 0,
"softirq" : 0,
"sys" : 0.25,
"usage" : 0.38,
"user" : 0.12
}
}
''

Code: Select all

[root@nagios libexec]# perl check_zevenet_cpu.pl -H HostIP -z Zapi Key -w 20 -c 10
Can't use an undefined value as filehandle reference at check_zevenet_cpu.pl line 179.
'
he pointed me to update the libraries but they seems to be up to date.

Code: Select all

Package libcurl-7.19.7-53.el6_9.x86_64 already installed and latest version
Nothing to do

`[root@nagios libexec]# rpm -qa | grep curl
python-pycurl-7.19.0-9.el6.x86_64

libcurl-7.19.7-53.el6_9.x86_64

curl-7.19.7-53.el6_9.x86_64

libcurl-devel-7.19.7-53.el6_9.x86_64
Any ideas?
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: ZEVENET Monitoring not returning Data

Post by tgriep »

Try this, edit the plugin and comment out this line by changing it from

Code: Select all

my $response_body;
to

Code: Select all

#my $response_body;
Then add these lines to the file at that location

Code: Select all

use File::Temp qw/tempfile/;
my $response_body = tempfile();
Save the file and test it out.

Does the author of the plugin have a minimum version of the libraries needed?
Be sure to check out our Knowledgebase for helpful articles and solutions!
lpereira
Posts: 143
Joined: Thu Jul 27, 2017 4:23 pm

Re: ZEVENET Monitoring not returning Data

Post by lpereira »

tgriep wrote:Try this, edit the plugin and comment out this line by changing it from

Code: Select all

my $response_body;
to

Code: Select all

#my $response_body;
Then add these lines to the file at that location

Code: Select all

use File::Temp qw/tempfile/;
my $response_body = tempfile();
Save the file and test it out.

Does the author of the plugin have a minimum version of the libraries needed?
According to their page:

Code: Select all

Debian Jessie:
apt-get update && apt-get install libwww-curl-perl libjson-perl libnagios-plugin-perl
If Perl modules doesn't exist in your distribution package manager, you can install manually:

Other distributions:
perl -MCPAN -e 'install WWW::Curl'
perl -MCPAN -e 'install JSON'
perl -MCPAN -e 'install Nagios::Plugin'  
what i have installed:

Code: Select all

[root@nagios libexec]# rpm -qa | grep curl
python-pycurl-7.19.0-9.el6.x86_64

libcurl-7.19.7-53.el6_9.x86_64

curl-7.19.7-53.el6_9.x86_64

libcurl-devel-7.19.7-53.el6_9.x86_64
i made the changes you requested.. here is the output:

Code: Select all

[root@nagios libexec]# sudo perl check_zevenet_cpu.pl -H HOSTIP -z ZAPYKEY -w 20 -c 10
malformed JSON string, neither array, object, number, string or atom, at character offset 0 (before "GLOB(0x66a560)") at check_zevenet_cpu.pl line 211
Locked