Announcement

Collapse
No announcement yet.

One step install and starting of windows agent

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    One step install and starting of windows agent

    put the zabbix windows agent exe file on a file share on your network.

    Then create a batch file on the same file share like name it installagent.bat or something like that. Installing agent now consists of just navigating to the file share and running the batch file, from each windows box.

    installagent.bat:
    @echo off
    echo copying exe

    net use y: \\server\fileshare
    xcopy Y:\path\to\exe\zabbixw32.exe c:\
    net use y: /delete


    echo creating config file

    echo Server=zabbix_server_ip_address > c:\zabbix_agentd.conf
    echo Hostname=%COMPUTERNAME% >> c:\zabbix_agentd.conf
    echo StartAgents=5 >> c:\zabbix_agentd.conf
    echo DebugLevel=3 >> c:\zabbix_agentd.conf
    echo PidFile=/var/tmp/zabbix_agentd.pid >> c:\zabbix_agentd.conf
    echo LogFile=/tmp/zabbix_agentd.log >> c:\zabbix_agentd.conf
    echo Timeout=3 >> c:\zabbix_agentd.conf

    echo installing service
    cd ../../../..
    c:\zabbixw32.exe install

    echo start service?
    pause

    net start zabbixagentdw32

    #2
    Not So Simple To Start Service

    I guess your was simple.

    I ran into an issue which I couldn't resolve.
    ZabbixW32.exe install for other windows I had but a few that I tried on was not running. Every time I started the service it will hang and fails.

    this is the message I got.

    C:\>net start zabbixagentdw32
    The Zabbix Win32 Agent service is starting........
    The Zabbix Win32 Agent service could not be started.

    More help is available by typing NET HELPMSG 3523.


    logs shows this:
    ************************************************** ************
    [30-Jun-2005 12:20:45] Log file opened
    [30-Jun-2005 12:20:59] Unable to add performance counter "\UnknownPerformanceCou
    nter(_Total)\UnknownPerformanceCounter" to query: The specified object is not fo
    und on the system.

    Any help will be greatly appreciated. thanks

    Comment


      #3
      test this, add a call function to:

      ....echo installing service
      cd ../../../..
      call c:\zabbixw32.exe install

      echo start service?
      pause......

      Comment


        #4
        check the ports

        Check the port its using also. I found the zabbix agent confliced with MSSQL and couldnt start, just changed the port it used and it worked.

        Comment


          #5
          Modified W32 installer

          Originally posted by DavidS
          put the zabbix windows agent exe file on a file share on your network.
          Here's a batch file I created based on the one above; it won't fail if Y: is already mapped (xcopy can use UNC paths), or if the computer doesn't have a local C: drive. Change \\server\share\path and ZABBIX_SERVER_IP, of course..

          If you're happy leaving the config file settings at the defaults (except hostname and server), you could even use this as a startup script in Active Directory.. combined with auto-discovery... hmm..

          install.bat:
          Code:
          @echo off
          echo Removing previously installed service...
          c:\ZabbixW32.exe stop
          c:\ZabbixW32.exe remove
          echo Deleting previously installed files...
          del c:\ZabbixW32.exe
          del c:\zabbix_agentd.conf
          
          echo Copying executable...
          xcopy /F \\server\share\path\ZabbixW32.exe %SystemDrive%\
          echo Creating configuration for %COMPUTERNAME%...
          echo Server=ZABBIX_SERVER_IP > %SystemDrive%\zabbix_agentd.conf
          echo Hostname=%COMPUTERNAME% >> %SystemDrive%\zabbix_agentd.conf
          echo Installing system service...
          %SystemDrive%\ZabbixW32.exe --config %SystemDrive%\zabbix_agentd.conf install
          echo Starting agent...
          %SystemDrive%\ZabbixW32.exe --config %SystemDrive%\zabbix_agentd.conf start
          echo Finished!
          pause

          Comment


            #6
            ¿?

            xcopy /F \\server\share\path\ZabbixW32.exe %SystemDrive%\
            Hi all

            im trying to install Zabbix agentd into Windows 2003 server. I don't test the agent on Windows yet but Im looking your batch script and I am confused. In Download section of Zabbix.com, there is a binarie file of Windows agentd. But not some file called ZabbixW32.exe.

            Can someone explain me a little about this file? I think I only need this zabbix_agentd.exe and no more

            Thanks

            Comment


              #7
              It was renamed in 1.4.x.

              ZabbixW32.exe - name of ZABBIX Windows agent, version 1.1.x
              zabbix_agentd.exe - name of ZABBIX Windows agent of version 1.4.x and higher
              Alexei Vladishev
              Creator of Zabbix, Product manager
              New York | Tokyo | Riga
              My Twitter

              Comment


                #8
                Yeah

                Ok, all ok. Thanks Alexei.

                Comment


                  #9
                  Here's my Windows Install Script

                  Still testing but so far so good...

                  Code:
                  echo off
                  ECHO.
                  
                  REM Mike Doherty 
                  REM Mikrodots, Inc.
                  REM http://www.mikrodots.com
                  
                  REM Zabbix Server Address
                  
                  REM UNC Path to Zabbix Agent installation files
                  set FilePath64="\\myserver\zabbix\win64\zabbix_agentd.exe"
                  set FilePath32="\\myserver\zabbix\win32\zabbix_agentd.exe" 
                  
                  REM Local Variables
                  set service="ZABBIX Agent"
                  set SUCCESS="Successfully"
                  REM I haven't tested this on a 64 bit OS yet
                  set qry="HKLM\System\CurrentControlSet\Services\Zabbix Agent"
                  
                  ECHO ---------- Start Zabbix Agent Script...
                  ECHO.
                  
                  :IsServiceInstalled
                  ECHO.
                  ECHO Is %service% Installed?
                  reg query %qry% | find /I %service% >NUL
                  ECHO  If Zero the service is Installed:%ERRORLEVEL%
                   If NOT ERRORLEVEL 1 (
                    ECHO   YES, %service% Is Installed
                    GOTO IsServiceRunning
                    ) ELSE (
                  	 ECHO NO, %service% Is NOT Installed
                  	 GOTO InstallService
                  	 )
                  GOTO END
                  
                  :IsServiceRunning
                  ECHO.
                  ECHO Is %service% Running?
                  net start | find /I %service% >NUL 
                  ECHO  If Zero %service% is Running:%ERRORLEVEL% 
                   If NOT ERRORLEVEL 1 (
                     ECHO   YES, %service% IS Running
                     ) ELSE (
                     	  ECHO ----------- NO, %service% IS NOT Running -----------------
                     	  GOTO StartService
                  	  )
                  GOTO END
                  
                  :StartService
                  ECHO.
                  ECHO Try to Start %service%
                  net start %service% | FIND /I %SUCCESS% >NUL
                  ECHO  If Zero the %service% started %ERRORLEVEL%
                   If NOT ERRORLEVEL 1 ( 
                     echo   YES %service% Started Successfully
                     ) ELSE ( 
                  	  ECHO ------------!!!!! %service% DID NOT START !!!!!--------------
                  	  )
                  GOTO END
                  
                  :GetInstallFilePath
                  ECHO.
                  REM 32Bit or 64 Bit?
                  REM Could use a better test, this will fail without a C: drive
                  if exist "C:\Program Files (x86)" (
                    set FilePath=%FilePath64%
                    ) else (
                  	  set FilePath=%FilePath32%
                  	  )
                  ECHO Path to zabbix_agentd.exe:  %FilePath%
                  
                  REM Verify that the installation file exists
                  XCOPY  %FilePath% /L | find /I %FilePath%  >NUL 
                  ECHO  If Zero %FilePath% Exists: %ERRORLEVEL% 
                   If NOT ERRORLEVEL 1 (
                     ECHO   YES, %FilePath% Exists
                     GOTO END  REM InstallService
                     ) ELSE (
                     	  ECHO %FilePath% 
                  	  ECHO ------------IS NOT VALID -----------------
                  	  ECHO -------------- EXITING -------------------
                     	  GOTO END
                  	  )
                  GOTO END
                  
                  :InstallService
                  ECHO.
                  REM Change working directory
                  CD %SystemDrive%\
                  REM Make sure we're on the right partition
                  %SystemDrive%
                  
                  ECHO Copying %FilePath% To %SystemDrive%
                  xcopy /F /Y /R %FilePath%
                  
                  ECHO Writing zabbix_agentd.conf for %COMPUTERNAME%.%USERDNSDOMAIN%
                  ECHO Server=1.2.3.4 > zabbix_agentd.conf
                  ECHO ServerPort=10050 >> zabbix_agentd.conf
                  ECHO Hostname=%COMPUTERNAME%.%USERDNSDOMAIN% >> zabbix_agentd.conf
                  ECHO ListenPort=10050 >> zabbix_agentd.conf
                  ECHO StartAgents=5 >> zabbix_agentd.conf
                  ECHO DebugLevel=3 >> zabbix_agentd.conf
                  ECHO LogFile= %SystemDrive%\zabbix_agentd.log >> zabbix_agentd.conf
                  ECHO Timeout=5 >> zabbix_agentd.conf
                  
                  ECHO Installing %service% as a service
                  %SystemDrive%\zabbix_agentd.exe -i -c %SystemDrive%\zabbix_agentd.conf
                  ECHO If Zero the %service% Installed Successfully: %ERRORLEVEL%
                   If ERRORLEVEL == 0 ( 
                     ECHO   YES, %service% Installed Successfully
                     GOTO IsServiceRunning
                     ) ELSE ( 
                  	  ECHO ------------!!!!! %service% Installation FAILED !!!!!--------------
                  	  GOTO END
                  	  )
                  ECHO Finished Installing Zabbix Agent!
                  
                  GOTO END
                  
                  :END
                  ECHO.
                  ECHO The Script has finnished running!
                  Only tested this on a 32 bit Vista system so far...

                  I'd like to get some feedback from anyone who tests this.

                  Thanks,

                  Mikrodots
                  Last edited by Mikrodots; 07-03-2008, 22:04.

                  Comment


                    #10
                    We already have install.bat for one step install of Windows agents under misc/win32floppy. I believe it works even for Vista
                    Alexei Vladishev
                    Creator of Zabbix, Product manager
                    New York | Tokyo | Riga
                    My Twitter

                    Comment


                      #11
                      Doh!

                      Thanks Alexei!

                      I wish I found that yesterday.

                      Anyway, my scripting needed some dusting off.

                      Comment


                        #12
                        Install from login script

                        Hi Alexei,

                        I did check out the win32floppy install but it does not completely do what I need.

                        I want to run an automated Windows installation from a batch logon script located on a UNC path. The script will run every time a user logs on.

                        The script must:
                        • Check if the Zabbix Agent is installed
                        • Install the agent if it is not already installed
                        • If installation is needed check for 64 bit OS or 32 to install the correct agent
                        • If the agent is installed, make sure it is running, if not, start it


                        Is there something already available that does this?

                        Thanks,

                        Mikrodots

                        Comment


                          #13
                          Originally posted by Mikrodots View Post
                          Hi Alexei,

                          I did check out the win32floppy install but it does not completely do what I need.

                          I want to run an automated Windows installation from a batch logon script located on a UNC path. The script will run every time a user logs on.

                          The script must:
                          • Check if the Zabbix Agent is installed
                          • Install the agent if it is not already installed
                          • If installation is needed check for 64 bit OS or 32 to install the correct agent
                          • If the agent is installed, make sure it is running, if not, start it


                          Is there something already available that does this?

                          Thanks,

                          Mikrodots
                          Look at this thread in this forum

                          What is left as an exercise to the reader is the check whether
                          "ZABBIX Agent" is running, e.g. net start | find "ZABBIX Agent"

                          HTH,

                          Norbert.

                          Comment


                            #14
                            Originally posted by DavidS View Post
                            put the zabbix windows agent exe file on a file share on your network.

                            Then create a batch file on the same file share like name it installagent.bat or something like that. Installing agent now consists of just navigating to the file share and running the batch file, from each windows box.

                            installagent.bat:
                            @echo off
                            echo copying exe

                            net use y: \\server\fileshare
                            xcopy Y:\path\to\exe\zabbixw32.exe c:\
                            net use y: /delete


                            echo creating config file

                            echo Server=zabbix_server_ip_address > c:\zabbix_agentd.conf
                            echo Hostname=%COMPUTERNAME% >> c:\zabbix_agentd.conf
                            echo StartAgents=5 >> c:\zabbix_agentd.conf
                            echo DebugLevel=3 >> c:\zabbix_agentd.conf
                            echo PidFile=/var/tmp/zabbix_agentd.pid >> c:\zabbix_agentd.conf
                            echo LogFile=/tmp/zabbix_agentd.log >> c:\zabbix_agentd.conf
                            echo Timeout=3 >> c:\zabbix_agentd.conf

                            echo installing service
                            cd ../../../..
                            c:\zabbixw32.exe install

                            echo start service?
                            pause

                            net start zabbixagentdw32

                            can you please describe in details ....How to install zabbix windows agent....

                            Comment


                              #15
                              Actually there are tutorial outside about installation of zabbix agentd on windows machine.

                              http://www.packtpub.com/article/moni...ith-zabbix-1.8

                              Comment

                              Working...
                              X