ZABBIX Forums  

Go Back   ZABBIX Forums > Zabbix Discussions and Feedback > Zabbix Cookbook

Reply
 
Thread Tools Display Modes
  #1  
Old 21-05-2005, 02:59
DavidS DavidS is offline
Junior Member
 
Join Date: May 2005
Posts: 1
Default 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
Reply With Quote
  #2  
Old 30-06-2005, 19:02
qong01 qong01 is offline
Junior Member
 
Join Date: Jun 2005
Posts: 4
Default 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
Reply With Quote
  #3  
Old 01-07-2005, 21:08
pabloadmin pabloadmin is offline
Member
Zabbix Certified Specialist
 
Join Date: Jan 2005
Location: argentina
Posts: 66
Thumbs up

test this, add a call function to:

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

echo start service?
pause......
Reply With Quote
  #4  
Old 11-07-2005, 06:12
bing bing is offline
Junior Member
 
Join Date: Jun 2005
Posts: 17
Default 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.
Reply With Quote
  #5  
Old 24-07-2007, 18:36
muramas muramas is offline
Junior Member
 
Join Date: Jul 2007
Posts: 1
Default Modified W32 installer

Quote:
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
Reply With Quote
  #6  
Old 04-03-2008, 09:52
ittec ittec is offline
Member
 
Join Date: Mar 2008
Posts: 71
Default ¿?

Quote:
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
Reply With Quote
  #7  
Old 05-03-2008, 16:29
Alexei Alexei is offline
Zabbix developer, product manager
 
Join Date: Sep 2004
Location: Riga, Latvia
Posts: 5,424
Lightbulb

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
Riga, Latvia
My Twitter
Reply With Quote
  #8  
Old 05-03-2008, 16:51
ittec ittec is offline
Member
 
Join Date: Mar 2008
Posts: 71
Default Yeah

Ok, all ok. Thanks Alexei.
Reply With Quote
  #9  
Old 07-03-2008, 19:36
Mikrodots Mikrodots is offline
Member
 
Join Date: Mar 2008
Posts: 37
Default 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 at 21:04.
Reply With Quote
  #10  
Old 07-03-2008, 20:28
Alexei Alexei is offline
Zabbix developer, product manager
 
Join Date: Sep 2004
Location: Riga, Latvia
Posts: 5,424
Lightbulb

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
Riga, Latvia
My Twitter
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 18:17.