Ad Widget

Collapse

Template for HP MSA 2040 (external check)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • RPW
    Junior Member
    • Oct 2008
    • 11

    #61
    Run script without speedyCGI

    Without speedyCGI change:
    #!/usr/bin/speedy

    to:
    #!/usr/bin/perl

    Comment

    • yuhung1981
      Junior Member
      • May 2018
      • 9

      #62
      Hi

      I downloaded the "2016-03-03 09:12' modified" version

      Use the default https method to display:
      [root@zabbix-sat yuhung]# perl /usr/lib/zabbix/externalscripts/hp-msa.pl 192.168.50.204 Zabbix s8CQ78NZjjsFLni lld
      File does not exist: Can't connect to 192.168.50.204:443

      at /usr/lib/zabbix/externalscripts/hp-msa.pl line 109.


      Change all the https to http in the script, which is displayed as

      [root@zabbix-sat yuhung]# perl /usr/lib/zabbix/externalscripts/hp-msa.pl 192.168.50.204 Zabbix s8CQ78NZjjsFLni lld
      Use of uninitialized value $ARGV[4] in string eq at /usr/lib/zabbix/externalscripts/hp-msa.pl line 121.
      Use of uninitialized value $ARGV[4] in string eq at /usr/lib/zabbix/externalscripts/hp-msa.pl line 124.
      Use of uninitialized value $ARGV[4] in string eq at /usr/lib/zabbix/externalscripts/hp-msa.pl line 127.
      Use of uninitialized value $ARGV[4] in string eq at /usr/lib/zabbix/externalscripts/hp-msa.pl line 130.
      Use of uninitialized value $ARGV[4] in string eq at /usr/lib/zabbix/externalscripts/hp-msa.pl line 133.

      Comment

      • iav
        Junior Member
        • Apr 2014
        • 10

        #63
        vdisks discovery not works for me.
        Code:
        hp-msa.pl "ipaddress" "zabbix" "password" "lld" "vdisks"
        {
           "data" : []
        }
        Other discoveries, like disks, volumes or power-supplies, works ok.
        Code:
        hp-msa.pl "ipaddress" "zabbix" "password" "lld" "power-supplies"
        {
           "data" : [
              {
                 "{#KEY}" : "psu_1.1",
                 "{#CLASS}" : "Power-supply"
              },
              {
                 "{#KEY}" : "psu_1.2",
                 "{#CLASS}" : "Power-supply"
              }
           ]
        }
        What's wrong?

        Comment

        • RPW
          Junior Member
          • Oct 2008
          • 11

          #64
          Hi,

          I have the following code in the hp-msa.pl für vdisk lld over https:

          Code:
          if ($function eq 'lld') {
              my $zbxArray = [];
          ...
                  getHPP200Objects ( $ua, $sessionKey, "https://$hostname/api/show/vdisks",
                             "virtual-disk", "name", "Vdisk", $zbxArray);
          ...
                  getHPP200Objects ( $ua, $sessionKey, "https://$hostname/api/show/enclosures",
                             "enclosures", "midplane-serial-number", "Enclosure", $zbxArray);
          
              print to_json({data => $zbxArray} , { ascii => 1, pretty => 1 }) . "\n";
          
              logOut($ua, $sessionKey, $hostname);
          Can you check if the api link does show the infos.
          Kind rgds,
          RPW

          Comment

          • mosidze
            Junior Member
            • May 2017
            • 4

            #65
            Past few days truing to install under zabbix4.0
            however
            Can't locate XML/Simple.pm in @INC (you may need to install the XML::Simple module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.22.1 /usr/local/share/perl/5.22.1 /usr/lib/x86_64-linux-gnu/perl5/5.22 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.22 /usr/share/perl/5.22 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base .) at ./hp-msa.pl line 8.
            BEGIN failed--compilation aborted at ./hp-msa.pl line 8.

            OS- Ubuntu 16. all Cpan modules were loaded, Build-essential also installed
            Did i miss something?

            Comment

            • everaldocabral
              Junior Member
              • Jan 2019
              • 9

              #66
              Supported?

              Comment

              • Apinar
                Junior Member
                • Jul 2020
                • 1

                #67
                Hi,

                In order to have this working in MSA 2050 (where the API changed a bit), you have to:

                In hp-msa-pl:

                change:

                Code:
                [COLOR=#d4d4d4] [/COLOR][COLOR=#c586c0]elsif[/COLOR][COLOR=#d4d4d4]([/COLOR][COLOR=#9cdcfe]$ARGV[/COLOR][COLOR=#d4d4d4][4] [/COLOR][COLOR=#dcdcaa]eq[/COLOR][COLOR=#d4d4d4] [/COLOR][COLOR=#ce9178]"vdisk"[/COLOR][COLOR=#d4d4d4]){[/COLOR]
                [COLOR=#d4d4d4]        getHPP200Objects ( [/COLOR][COLOR=#9cdcfe]$ua[/COLOR][COLOR=#d4d4d4], [/COLOR][COLOR=#9cdcfe]$sessionKey[/COLOR][COLOR=#d4d4d4], [/COLOR][COLOR=#ce9178]"https://[/COLOR][COLOR=#9cdcfe]$hostname[/COLOR][COLOR=#ce9178]/api/show/[B]vdisks[/B]"[/COLOR][COLOR=#d4d4d4], [/COLOR][COLOR=#ce9178]"[B]virtual-disk[/B]"[/COLOR][COLOR=#d4d4d4], [/COLOR][COLOR=#ce9178]"name"[/COLOR][COLOR=#d4d4d4], [/COLOR][COLOR=#ce9178]"Vdisk"[/COLOR][COLOR=#d4d4d4], [/COLOR][COLOR=#9cdcfe]$zbxArray[/COLOR][COLOR=#d4d4d4]);[/COLOR]
                [COLOR=#d4d4d4]    }[/COLOR]
                to

                Code:
                [COLOR=#c586c0]elsif[/COLOR][COLOR=#d4d4d4]([/COLOR][COLOR=#9cdcfe]$ARGV[/COLOR][COLOR=#d4d4d4][4] [/COLOR][COLOR=#dcdcaa]eq[/COLOR][COLOR=#d4d4d4] [/COLOR][COLOR=#ce9178]"vdisk"[/COLOR][COLOR=#d4d4d4]){[/COLOR]
                [COLOR=#d4d4d4]        getHPP200Objects ( [/COLOR][COLOR=#9cdcfe]$ua[/COLOR][COLOR=#d4d4d4], [/COLOR][COLOR=#9cdcfe]$sessionKey[/COLOR][COLOR=#d4d4d4], [/COLOR][COLOR=#ce9178]"http://[/COLOR][COLOR=#9cdcfe]$hostname[/COLOR][COLOR=#ce9178]/api/show/[B]disk-groups[/B]"[/COLOR][COLOR=#d4d4d4], [/COLOR][COLOR=#ce9178]"[B]disk-group[/B]"[/COLOR][COLOR=#d4d4d4], [/COLOR][COLOR=#ce9178]"name"[/COLOR][COLOR=#d4d4d4], [/COLOR][COLOR=#ce9178]"Vdisk"[/COLOR][COLOR=#d4d4d4], [/COLOR][COLOR=#9cdcfe]$zbxArray[/COLOR][COLOR=#d4d4d4]);[/COLOR]
                [COLOR=#d4d4d4]    }[/COLOR]

                change:

                Code:
                [COLOR=#c586c0]elsif[/COLOR][COLOR=#d4d4d4]([/COLOR][COLOR=#9cdcfe]$ARGV[/COLOR][COLOR=#d4d4d4][4] [/COLOR][COLOR=#dcdcaa]eq[/COLOR][COLOR=#d4d4d4] [/COLOR][COLOR=#ce9178]"vdisk"[/COLOR][COLOR=#d4d4d4]){[/COLOR]
                [COLOR=#d4d4d4]       getHPP2000StatObj ( [/COLOR][COLOR=#9cdcfe]$ua[/COLOR][COLOR=#d4d4d4], [/COLOR][COLOR=#9cdcfe]$sessionKey[/COLOR][COLOR=#d4d4d4], [/COLOR][COLOR=#ce9178]"https://[/COLOR][COLOR=#9cdcfe]$hostname[/COLOR][COLOR=#ce9178]/api/show/[B]vdisks[/B]"[/COLOR][COLOR=#d4d4d4], [/COLOR][COLOR=#ce9178]"[B]virtual-disk[/B]"[/COLOR][COLOR=#d4d4d4], [/COLOR][COLOR=#ce9178]"name"[/COLOR][COLOR=#d4d4d4], [/COLOR][COLOR=#9cdcfe]$ARGV[/COLOR][COLOR=#d4d4d4][5], [/COLOR][COLOR=#9cdcfe]$ARGV[/COLOR][COLOR=#d4d4d4][6]);[/COLOR]
                [COLOR=#d4d4d4]    }[/COLOR]
                to

                Code:
                [COLOR=#c586c0]elsif[/COLOR][COLOR=#d4d4d4]([/COLOR][COLOR=#9cdcfe]$ARGV[/COLOR][COLOR=#d4d4d4][4] [/COLOR][COLOR=#dcdcaa]eq[/COLOR][COLOR=#d4d4d4] [/COLOR][COLOR=#ce9178]"vdisk"[/COLOR][COLOR=#d4d4d4]){[/COLOR]
                [COLOR=#d4d4d4]       getHPP2000StatObj ( [/COLOR][COLOR=#9cdcfe]$ua[/COLOR][COLOR=#d4d4d4], [/COLOR][COLOR=#9cdcfe]$sessionKey[/COLOR][COLOR=#d4d4d4], [/COLOR][COLOR=#ce9178]"http://[/COLOR][COLOR=#9cdcfe]$hostname[/COLOR][COLOR=#ce9178]/api/show/[B]disk-groups[/B]"[/COLOR][COLOR=#d4d4d4], [/COLOR][COLOR=#ce9178]"[B]disk-group[/B]"[/COLOR][COLOR=#d4d4d4], [/COLOR][COLOR=#ce9178]"name"[/COLOR][COLOR=#d4d4d4], [/COLOR][COLOR=#9cdcfe]$ARGV[/COLOR][COLOR=#d4d4d4][5], [/COLOR][COLOR=#9cdcfe]$ARGV[/COLOR][COLOR=#d4d4d4][6]);[/COLOR]
                [COLOR=#d4d4d4]    }[/COLOR]


                And having the xml template already imported, go to HP MSA Enclosure Discovery, and inTrigger prototypes and change "Enclosure[{#KEY}] Status changed" expression from:

                Code:
                {Template HP MSA 2040:hp-msa.pl[{$MSA1},{$USER},{$PASSWORD},"data", "enclosure", {#KEY}, "status"].iregexp([COLOR=#e74c3c][B]up[/B][/COLOR])}=0
                to

                Code:
                {Template HP MSA 2040:hp-msa.pl[{$MSA1},{$USER},{$PASSWORD},"data", "enclosure", {#KEY}, "status"].iregexp([COLOR=#e74c3c][B]ok[/B][/COLOR])}=0


                I hope this helps.

                BR,

                Comment

                • sphtd7
                  Member
                  • Dec 2020
                  • 52

                  #68
                  I cant use it on mu Ubuntu beacause i cant install speedy cgi perl.. But i ts required. What I can do? Thanks.

                  Ok i just change usr/bin/ to perl ..

                  But i have problem with SSL cert



                  /usr/lib/zabbix/externalscripts$ perl hp-msa.pl 172.16.14.197 login pass lld controller
                  Unsuccessful stat on filename containing newline at /usr/share/perl5/XML/Simple.pm line 967.
                  Unsuccessful stat on filename containing newline at /usr/share/perl5/XML/Simple.pm line 980.
                  File does not exist: Can't connect to 172.16.14.197:443 (certificate verify failed)

                  SSL connect attempt failed error:1416F086:SSL routines:tls_process_server_certificate:certificat e verify failed at /usr/share/perl5/LWP/Protocol/http.pm line 50.
                  at hp-msa.pl line 109.

                  Last edited by sphtd7; 18-12-2020, 12:34.

                  Comment

                  • lazar.gyula
                    Junior Member
                    • Mar 2021
                    • 5

                    #69
                    Originally posted by sphtd7
                    I cant use it on mu Ubuntu beacause i cant install speedy cgi perl.. But i ts required. What I can do? Thanks.

                    Ok i just change usr/bin/ to perl ..

                    But i have problem with SSL cert



                    /usr/lib/zabbix/externalscripts$ perl hp-msa.pl 172.16.14.197 login pass lld controller
                    Unsuccessful stat on filename containing newline at /usr/share/perl5/XML/Simple.pm line 967.
                    Unsuccessful stat on filename containing newline at /usr/share/perl5/XML/Simple.pm line 980.
                    File does not exist: Can't connect to 172.16.14.197:443 (certificate verify failed)

                    SSL connect attempt failed error:1416F086:SSL routines:tls_process_server_certificate:certificat e verify failed at /usr/share/perl5/LWP/Protocol/http.pm line 50.
                    at hp-msa.pl line 109.
                    Hi,

                    Same problem here. Is there any solution?

                    Comment

                    • sphtd7
                      Member
                      • Dec 2020
                      • 52

                      #70
                      Originally posted by lazar.gyula
                      Hi,

                      Same problem here. Is there any solution?
                      Leave this template, I struggled with it for too long .. I found another one where installation takes 5 minutes maximum and is very easy. Follow the instructions step by step and you will succeed!


                      Comment

                      • lazar.gyula
                        Junior Member
                        • Mar 2021
                        • 5

                        #71
                        Originally posted by sphtd7

                        Leave this template, I struggled with it for too long .. I found another one where installation takes 5 minutes maximum and is very easy. Follow the instructions step by step and you will succeed!

                        It is working well. Thank you.

                        Comment

                        • RMSX
                          Junior Member
                          • Nov 2021
                          • 1

                          #72
                          Hello,

                          Is it possible to remove or skip the certificate verification please ?

                          Thanks.

                          Comment

                          Working...