Ad Widget

Collapse

ESXi 4.0 Hardware and Software Monitoring VMWare

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mamema
    Junior Member
    • Aug 2012
    • 2

    #151
    try to get this running.
    had first problems with installing of the vmware perl sdk, and i'm not dsure if it is running correctly.

    Now i do not get any files created in /tmp
    both perl scripts in the zabbix folder have a output of "1" if run from the commandline
    in the agentd log i have a "No such file or directory"

    I guess its the perl script, but i see no error. Is there a higher log level possible?

    regards

    mamema

    Update: got a step further. If i execute the script zabbix_perl_api_vmware.pl from command line with the same serverip/username/pw on the commandline, which is the same as in the script (i edited it) then it works, which is odd, cause the values are the same.
    This is not working with the wbem script and not from the zabbix server invoked.....
    I also have this in the logs:
    sh: /etc/zabbix/zabbix_wbem_vmware.pl: /usr/bin/perl^M: bad interpreter: No such file or directory

    and this:

    2305:20120820:172126.547 Zabbix agent item [API[{$HOST},{$PASSWORD},{$USERNAME}]] on host [servname] failed: first network error, wait for 15 seconds
    Last edited by mamema; 20-08-2012, 16:38. Reason: minor success

    Comment

    • dima_dm
      Senior Member
      • Dec 2009
      • 2697

      #152
      Originally posted by mamema
      Update: got a step further. If i execute the script zabbix_perl_api_vmware.pl from command line with the same serverip/username/pw on the commandline, which is the same as in the script (i edited it) then it works, which is odd, cause the values are the same.
      This is not working with the wbem script and not from the zabbix server invoked.....
      I also have this in the logs:
      sh: /etc/zabbix/zabbix_wbem_vmware.pl: /usr/bin/perl^M: bad interpreter: No such file or directory
      CR/LF is the way windows writes end-of-line in text files.
      Unix only uses LF, so ou have to change it for the script to work.
      A command which works with all distros is:

      tr -d '\r' < input.file > output.file
      Example
      tr -d '\r' < zabbix_wbem_vmware.pl >zabbix_wbem_vmware.pl.new

      Comment

      • dima_dm
        Senior Member
        • Dec 2009
        • 2697

        #153
        If the script takes over 30 seconds, you also have to adjust the source code of Zabbix a bit to be able to increase the timeout of the agent.
        Originally posted by mamema
        can you be more specific what you did, please?

        Comment

        • Kryol
          Member
          • Feb 2011
          • 70

          #154
          After upgrade to zabbix 2.0.2 items API[*] became unsupported.

          Under zabbix 1.8.13 all worked fine.

          Comment

          • ehermouet
            Member
            • May 2011
            • 50

            #155
            Hi,

            i'm lost where must be install wbem ? on esx ? how ?

            Comment

            • ehermouet
              Member
              • May 2011
              • 50

              #156
              message delete. error from me
              Last edited by ehermouet; 03-09-2012, 16:43.

              Comment

              • ehermouet
                Member
                • May 2011
                • 50

                #157
                i think it's because i have don't understand all info.

                that i do:

                install hp agent on esx server
                install vi perl on zabbix server
                wbem is on zabbix server and esx server

                that's right ?

                edit
                i have this error message
                * /usr/bin/wbemcli: Cim: (3) CIM_ERR_INVALID_NAMESPACE: Invalid namespace

                when i do this /usr/bin/wbemcli ei -noverify "https://root:*****@192.168.1.33/root/hpq:SMX_FAN"

                agent is installed and i have accès with http interface on esx server


                and on zabbix 2 i have -> After upgrade to zabbix 2.0.2 items API[*] became unsupported.
                /etc/zabbix/zabbix_perl_api_vmware.pl [IP] [password] [username] work and i have my tmp file (but only work manualy)

                tks advance
                Last edited by ehermouet; 04-09-2012, 15:59.

                Comment

                • geek74
                  Junior Member
                  • Aug 2012
                  • 9

                  #158
                  An other approach

                  Hi,

                  First I was using this monitoring for ESX4 machines, but after upgrading to ESX5 it was taking too long. So I rewrote everything and I used credstore_admin.pl for vmware SDK to store the user credential, so you do not need to put these as macro, I prefer not exposing admin password in zabbix UI.

                  Now my script takes less than 10 s to executes. If somebody is interested I can post my scripts.

                  My scripts support HP and Dell hardware with auto discovery.

                  Comment

                  • Kryol
                    Member
                    • Feb 2011
                    • 70

                    #159
                    Originally posted by geek74
                    Hi,

                    First I was using this monitoring for ESX4 machines, but after upgrading to ESX5 it was taking too long. So I rewrote everything and I used credstore_admin.pl for vmware SDK to store the user credential, so you do not need to put these as macro, I prefer not exposing admin password in zabbix UI.
                    How to store credential for wbemcli?

                    Now my script takes less than 10 s to executes. If somebody is interested I can post my scripts.
                    Could you publish these scripts here?

                    Comment

                    • geek74
                      Junior Member
                      • Aug 2012
                      • 9

                      #160
                      template + scripts

                      Here is my little contribution (I am not a perl master, so if you can help me to improve) :

                      So here are the instructions :

                      - First you need vSphere SDK installed coorectly. http://pubs.vmware.com/vsphere-50/in...neref.6.1.html

                      - After you have to store the ESX credentials :
                      under Ubuntu
                      $ sudo -i
                      # /usr/lib/vmware-vcli/apps/general/credstore_admin.pl add -s <ESX_IP> -u <root> -p <password>

                      the credentials will be stored in /root/.vmware/credstore/vicredentials.xml

                      - in /etc/sudoers add the following :
                      zabbix ALL=(root)NOPASSWD:/etc/zabbix/zabbix_esx_get_data.pl *


                      - In zabbix_agentd.conf add the following :
                      UserParameter=esx.item.discovery[*],/etc/zabbix/esx.item.discovery $1 $2
                      UserParameter=esx-get-data[*],sudo /etc/zabbix/zabbix_esx_get_data.pl
                      --server $1
                      UserParameter=esx_get_value[*],/etc/zabbix/zabbix_esx_get_value.pl $1 $2 $3

                      - modify the timeout value = 15 should be enough

                      - Put all the scripts in /etc/zabbix/ with execution rights without .txt extension

                      esx.item.discovery : autodiscovery of the hardware
                      zabbix_esx_get_data.pl : download the data from the ESX and create the data file
                      zabbix_esx_get_value.pl : retrieve the desired data from the data file

                      -Now restart zabbix_agent.

                      - create /var/log/esx-mon directory

                      - create /etc/logrotate.d/esx-mon with the following content :
                      /var/log/esx-mon/esx-mon.log {
                      daily
                      rotate 7
                      compress
                      missingok
                      notifempty
                      sharedscripts
                      create 640 root root
                      }


                      - After import the template ESX in your zabbix and create your first ESX server.
                      hostname : esx_hostname
                      agent interface : ip of the zabbix server
                      template : Template_ESX_dellR720
                      Tab Macro :
                      macro : {$ESX_IP} value : YOUR.ESX.IP


                      You can check that the monitoring is working by checking /tmp/<ESX_IP>-esx-data file


                      Please content and help me to improve.

                      Cheers,
                      Attached Files
                      Last edited by geek74; 20-11-2012, 12:34.

                      Comment

                      • Kryol
                        Member
                        • Feb 2011
                        • 70

                        #161
                        As I see you exclude perfomance counters.

                        These counters are time expensive but some of them contains useful information, e.g. network transfer rate.

                        Comment

                        • geek74
                          Junior Member
                          • Aug 2012
                          • 9

                          #162
                          You have the cpu and memory usage.

                          And if you need network transfert rate, maybe it is faster to do it via snmp .

                          Comment

                          • Kryol
                            Member
                            • Feb 2011
                            • 70

                            #163
                            I use modified script to request centrally the ESX hosts via the VCC http://www.zabbix.com/forum/showpost...1&postcount=74.

                            I tried to invoke this script on zabbix server, VCC and VMA and found that execution times differ.

                            E.g.
                            Zabbix ~ 23s
                            VCC ~11s
                            VMA ~8,5s

                            I cannot explain this behaviour.
                            This is not network features because all of above servers are on same ESXi.

                            Could somebody try to explain?

                            Comment

                            • Kryol
                              Member
                              • Feb 2011
                              • 70

                              #164
                              And another question.

                              I compared execution time for scripts to request data through VCC and directly from ESXi server.

                              Firsh of them is faster. I think it's very strange.

                              Am I wrong?

                              Comment

                              • dima_dm
                                Senior Member
                                • Dec 2009
                                • 2697

                                #165
                                Originally posted by Kryol
                                And another question.

                                I compared execution time for scripts to request data through VCC and directly from ESXi server.

                                Firsh of them is faster. I think it's very strange.

                                Am I wrong?
                                Because in VCC is cached results of status, and VCC polling ESXi by scheduling.

                                Comment

                                Working...