district09 / check_netapp_ontap

:four_leaf_clover: Check NetApp Ontap :four_leaf_clover:
https://outsideit.net/monitoring-netapp-ontap/
GNU General Public License v3.0
40 stars 27 forks source link

compilation error in "Dev (#49)" #53

Closed tgoetheyn closed 7 years ago

tgoetheyn commented 7 years ago

Hi,

I'm a collegue of Willemdh and he added me to this project for further development. I try to get "Dev (#49)" working but I get:

Type of arg 1 to keys must be hash (not hash element) at check_netapp_ontap.pl line 270, near "}) " Execution of check_netapp_ontap.pl aborted due to compilation errors.

if i can get this version to work, i can check it with our new netap with ontap 9.1 and commit it to the master branch. But because i don't wanna go throught te various commits, I ask for a little assistance :-)

Gtz, Tony

Tontonitch commented 7 years ago

Could you tell me what's the exact launched command so I can test it on my side?

tgoetheyn commented 7 years ago

just "perl check_netapp_ontap.pl" The Netapp SDK is present in the right location

Tontonitch commented 7 years ago

I took the script from the dev branch and I don't face any issue on my server:

[root@monitorsrv1 tmp]# vi check_netapp_ontap_cc141ea.pl
[root@monitorsrv1 tmp]# cksum check_netapp_ontap_cc141ea.pl
3204692129 88313 check_netapp_ontap_cc141ea.pl
[root@monitorsrv1 tmp]# chmod a+x check_netapp_ontap_cc141ea.pl
[root@monitorsrv1 tmp]# ./check_netapp_ontap_cc141ea.pl
A required option is not set!

check_netapp_ontapi version: v2.07.170621
By John Murphy <john.murphy@roshamboot.org>, Willem D'Haese <willem.dhaese@gmail.com>, GNU GPL License

Usage: ./check_netapp_ontapi.pl -H <hostname> -u <username> -p <password> -o <option> [ -w <warning_thresh> -c <critical_thresh> -m <include|exclude,pattern1,pattern2,etc> ]

--hostname, -H
        Hostname or address of the cluster administrative interface.
--node, -n
        Name of a vhost or cluster-node to restrict this query to.
--user, -u
        Username of a Netapp Ontapi enabled user.
[...]

disk_spare
        desc: Check the number of spare disks
        thresh: Warning / critical required spare disks. Default thresholds are 2 / 1.
        node: The node option restricts this check by cluster-node name.

* For keyword thresholds, if you want to ignore alerts for that particular keyword you set it at the same threshold that the alert defaults to.

[root@monitorsrv1 tmp]#
[root@monitorsrv1 tmp]# perl ./check_netapp_ontap_cc141ea.pl
A required option is not set!

check_netapp_ontapi version: v2.07.170621
By John Murphy <john.murphy@roshamboot.org>, Willem D'Haese <willem.dhaese@gmail.com>, GNU GPL License

Usage: ./check_netapp_ontapi.pl -H <hostname> -u <username> -p <password> -o <option> [ -w <warning_thresh> -c <critical_thresh> -m <include|exclude,pattern1,pattern2,etc> ]

--hostname, -H
        Hostname or address of the cluster administrative interface.
--node, -n
        Name of a vhost or cluster-node to restrict this query to.
[...]

disk_spare
        desc: Check the number of spare disks
        thresh: Warning / critical required spare disks. Default thresholds are 2 / 1.
        node: The node option restricts this check by cluster-node name.

* For keyword thresholds, if you want to ignore alerts for that particular keyword you set it at the same threshold that the alert defaults to.

[root@monitorsrv1 tmp]#
Tontonitch commented 7 years ago

For your info, my perl version:

[root@monitorsrv1 tmp]# yum info perl
Loaded plugins: enabled_repos_upload, package_upload, priorities, product-id, search-disabled-repos, subscription-manager
227 packages excluded due to repository priority protections
Installed Packages
Name        : perl
Arch        : x86_64
Epoch       : 4
Version     : 5.16.3
Release     : 292.el7
Size        : 22 M
Repo        : installed
From repo   : rhel-7-server-rpms
Summary     : Practical Extraction and Report Language
URL         : http://www.perl.org/
License     : (GPL+ or Artistic) and (GPLv2+ or Artistic) and Copyright Only and MIT and Public Domain and UCD
Description : Perl is a high-level programming language with roots in C, sed, awk and shell
            : scripting.  Perl is good at handling processes and files, and is especially
            : good at handling text.  Perl's hallmarks are practicality and efficiency.
            : While it is used to do a lot of different things, Perl's most common
            : applications are system administration utilities and web programming.  A large
            : proportion of the CGI scripts on the web are written in Perl.  You need the
            : perl package installed on your system so that your system can handle Perl
            : scripts.
            :
            : Install this package if you want to program in Perl or enable your system to
            : handle Perl scripts.

Uploading Enabled Repositories Report
Loaded plugins: priorities, product-id
[root@monitorsrv1 tmp]#
tgoetheyn commented 7 years ago

I checked my perl version and it is the latest available on the Centos Base repo:

Installed Packages
Name        : perl
Arch        : x86_64
Epoch       : 4
Version     : 5.10.1
Release     : 144.el6
Size        : 34 M
Repo        : installed
From repo   : base
Summary     : Practical Extraction and Report Language
URL         : http://www.perl.org/
License     : (GPL+ or Artistic) and (GPLv2+ or Artistic) and Copyright Only and MIT and Public Domain and UCD
Description : Perl is a high-level programming language with roots in C, sed, awk
            : and shell scripting.  Perl is good at handling processes and files,
            : and is especially good at handling text.  Perl's hallmarks are
            : practicality and efficiency.  While it is used to do a lot of
            : different things, Perl's most common applications are system
            : administration utilities and web programming.  A large proportion of
            : the CGI scripts on the web are written in Perl.  You need the perl
            : package installed on your system so that your system can handle Perl
            : scripts.
            :
            : Install this package if you want to program in Perl or enable your
            : system to handle Perl scripts.
tgoetheyn commented 7 years ago

I don't know if I can upgrade, becaus i don't want to break al the other checks on our Nagios server.

If I find some time I'll check it on one of our test servers and let you know i the problem persists with the new version

Tontonitch commented 7 years ago

I've tried on an old server having your perl version (perl5 revision 5 version 10 subversion 1) and reproduced your error. I will try to look at that. But if I remember well that's not a part I've modified.

tgoetheyn commented 7 years ago

probably has something to do with this:

Starting with Perl 5.14, keys can take a scalar EXPR, which must contain a reference to an unblessed hash or array. The argument will be dereferenced automatically. This aspect of keys is considered highly experimental. The exact behaviour may change in a future version of Perl.

Tontonitch commented 7 years ago

Above PR to fix that reference problem