View Full Version : 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
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
pabloadmin
01-07-2005, 22:08
test this, add a call function to:
....echo installing service
cd ../../../..
call c:\zabbixw32.exe install
echo start service?
pause......
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.
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:
@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
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 :confused:
Thanks
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
Ok, all ok. Thanks Alexei.
Mikrodots
07-03-2008, 20:36
Still testing but so far so good...
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
We already have install.bat for one step install of Windows agents under misc/win32floppy. I believe it works even for Vista :)
Mikrodots
07-03-2008, 22:03
Thanks Alexei!
I wish I found that yesterday.
Anyway, my scripting needed some dusting off.
:p
Mikrodots
10-03-2008, 19:04
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
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 (http://www.zabbix.com/forum/showthread.php?t=4460&page=3)
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.
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....
frankcheong
07-10-2011, 05:20
Actually there are tutorial outside about installation of zabbix agentd on windows machine.
http://www.packtpub.com/article/monitoring-windows-with-zabbix-1.8
emil@exoconsult
20-10-2011, 15:12
Still testing but so far so good...
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
There is an elegant way of finding the OS architecture (32 or 64 bit) by using
wmic OS get OSArchitecture | find /I "64-bit"
if not errorlevel 1 (set FilePath=%FilePath64%
) else (
set FilePath=%FilePath32%
)
ECHO Path to zabbix_agentd.exe: %FilePath%
emil@exoconsult
21-10-2011, 15:41
Hi All
I've made my own version of the install script originally posted here.
This script stops the service, uninstalls the agent and then installs and starts the new version of the agent from the server. It also adds a firewall rule (windows 7 / server 2008) and has a little more sophisticated way of telling the architecture.
An install directory is also made an option and it supports installs with proxy as well.
Let me hear what you think.
/Emil
@echo off
ECHO.
REM ***** Parameters START *****
REM UNC Path to Zabbix Agent installation files
set FilePath64=\\myserver\zabbixinstall\win64\zabbix_a gentd.exe
set FilePath32=\\myserver\zabbixinstall\win32\zabbix_a gentd.exe
REM Agent configuration
REM ----- IMPORTANT ----- Set proxyip to NONE if no proxy is used
set proxyip=0.0.0.0
set serverip=0.0.0.0
set listenport=10050
set serverport=10051
set InstallDir=ZabbixAgent
REM Local Variables
set service="Zabbix Agent"
set SUCCESS="Successfully"
set qry="HKLM\System\CurrentControlSet\Services\Zabbix Agent"
REM ***** Parameters END *****
ECHO ---------- Start Zabbix Agent (Re)Install Script...
ECHO.
:IsServiceInstalled
ECHO.
ECHO Is %service% Installed?
reg query %qry% | find /I %service% >NUL
If NOT ERRORLEVEL 1 (
ECHO %service% Is Installed
GOTO IsServiceRunning
) ELSE (
ECHO %service% Is NOT Installed
GOTO GetInstallFilePath
)
GOTO END
:IsServiceRunning
ECHO.
ECHO Is %service% Running?
net start | find /I %service% >NUL
If NOT ERRORLEVEL 1 (
ECHO %service% IS Running
GOTO StopService
) ELSE (
ECHO %service% is not running
GOTO RemoveService
)
GOTO END
:StopService
ECHO.
ECHO Try to Stop %service%
net stop %service% >NUL
If NOT ERRORLEVEL 1 (
echo %service% Stopped Successfully
GOTO RemoveService
) ELSE (
ECHO ------------!!!!! %service% DID NOT STOP !!!!!--------------
)
GOTO END
:RemoveService
ECHO.
REM Change working directory and partition and create InstallDir if it does not exist
if not exist %SystemDrive%\%InstallDir%\. mkdir %SystemDrive%\%InstallDir%
CD %SystemDrive%\%InstallDir%
%SystemDrive%
REM Remove Installation
ECHO Remove %service% installation
echo Server=%server% >zabbix_agentd.conf
ECHO Copying %FilePath% To %SystemDrive%\%InstallDir%
xcopy /F /Y /R %FilePath%
%SystemDrive%\%InstallDir%\zabbix_agentd.exe --uninstall -c %SystemDrive%\%InstallDir%\zabbix_agentd.conf
If ERRORLEVEL == 0 (
ECHO %service% Uninstalled Successfully!
GOTO GetInstallFilePath )
ELSE
(
ECHO %Service Uninstall NOT successful!
GOTO END
)
GOTO END
:GetInstallFilePath
ECHO.
REM 32Bit or 64 Bit?
wmic OS get OSArchitecture | find /I "64-bit"
if not errorlevel 1 (set FilePath=%FilePath64%
ECHO 64 Bit Operating System - using %FilePath%
) else (
set FilePath=%FilePath32%
ECHO 32 Bit Operating System - using %FilePath%
)
REM Verify that the installation file exists
XCOPY %FilePath% /L /Y | find /I "%FilePath%" >NUL
If NOT ERRORLEVEL 1 (
GOTO InstallService
) ELSE (
ECHO %FilePath%
ECHO ------------IS NOT VALID -----------------
ECHO -------------- EXITING -------------------
GOTO END
)
GOTO END
:InstallService
ECHO.
REM Change working directory and partition and create InstallDir if it does not exist
if not exist %SystemDrive%\%InstallDir%\. mkdir %SystemDrive%\%InstallDir%
CD %SystemDrive%\%InstallDir%
%SystemDrive%
if exist %systemdrive%\%InstallDir%\zabbix_agentd.exe del /Q %systemdrive%\%InstallDir%\zabbix_agent.exe
ECHO Copying %FilePath% To %SystemDrive%\%InstallDir%
xcopy /F /Y /R %FilePath%
ECHO Writing Configuration File for %COMPUTERNAME%.%USERDNSDOMAIN%
IF NOT %proxyip%=="NONE" (ECHO Server=%proxyip%,%serverip% > zabbix_agentd.conf
) ELSE (
ECHO Server=%serverip% >zabbix_agentd.conf
)
ECHO ServerPort=%serverport% >> zabbix_agentd.conf
ECHO Hostname=%COMPUTERNAME%at%USERDNSDOMAIN% >> zabbix_agentd.conf
ECHO ListenPort=%listenport% >> zabbix_agentd.conf
ECHO StartAgents=5 >> zabbix_agentd.conf
ECHO DebugLevel=3 >> zabbix_agentd.conf
ECHO LogFile= %SystemDrive%\%InstallDir%\zabbix_agentd.log >> zabbix_agentd.conf
ECHO Timeout=5 >> zabbix_agentd.conf
ECHO Installing %service% as a service
%SystemDrive%\%InstallDir%\zabbix_agentd.exe -i -c %SystemDrive%\%InstallDir%\zabbix_agentd.conf
If ERRORLEVEL == 0 (
ECHO %service% Installed Successfully
GOTO StartService
) ELSE (
ECHO ----- %service% Installation FAILED -----
GOTO END
)
GOTO END
:StartService
ECHO.
ECHO Adding rule to firewall...
netsh advfirewall firewall add rule name=%service% protocol=TCP dir=in localport=%listenport% action=allow
echo.
ECHO Try to Start %service%
net start %service% >NUL
If NOT ERRORLEVEL 1 (
echo %service% Started Successfully
) ELSE (
ECHO ------------!!!!! %service% DID NOT START !!!!!--------------
)
GOTO END
:END
ECHO.
ECHO The Script has finished running!
If have build also my own script:
1) First i detect if its a reinstall of a new install.
2) Then I check if its a 32 of 64 bit machine.
3) Then we ask how the machine is called in Zabbix
4) Then we ask which proxy is going to monitor the machine.
5) Then we check if the zabbix server is able to connect to the agent. (agent.php on the zabbix server)
Zabbix.cmd:
@ECHO OFF
CLS
NET START | FIND "Zabbix Agent">NUL
IF "%ERRORLEVEL%"=="1" GOTO Detect
IF "%ERRORLEVEL%"=="0" GOTO Reinstall
:Reinstall
NET STOP "Zabbix Agent"
SC DELETE "Zabbix Agent"
IF EXIST C:\Zabbix\ (
RMDIR /S /Q C:\Zabbix\
CLS
GOTO :Detect
)
:Detect
IF "%PROCESSOR_ARCHITECTURE%" == "x86" (
GOTO x86
)
IF "%PROCESSOR_ARCHITECTURE%" == "i86" (
GOTO x86
)
IF "%PROCESSOR_ARCHITECTURE%" == "x64" (
GOTO x64
)
IF "%PROCESSOR_ARCHITECTURE%" == "AMD64" (
GOTO x64
)
IF "%PROCESSOR_ARCHITECTURE%" == "amd64" (
GOTO x64
)
:x86
set /p answer=What is the hostname in Zabbix
ECHO Which proxy is monitoring the server ?
ECHO .
ECHO .
set /p answer2=(proxy ip):
MKDIR C:\Zabbix\
ECHO Server=%answer2%, server > C:\Zabbix\zabbix_agentd.conf
ECHO EnableRemoteCommands=1 >> C:\Zabbix\zabbix_agentd.conf
ECHO Hostname=%answer% >> C:\Zabbix\zabbix_agentd.conf
ECHO StartAgents=32 >> C:\Zabbix\zabbix_agentd.conf
COPY \\10.208.60.61\install\x86\*.* C:\Zabbix\
GOTO Install
:x64
set /p answer=What is the hostname in Zabbix
ECHO Which proxy is monitoring the server ?
ECHO .
ECHO .
set /p answer2=(proxy ip):
MKDIR C:\Zabbix\
ECHO Server=%answer2%, server > C:\Zabbix\zabbix_agentd.conf
ECHO EnableRemoteCommands=1 >> C:\Zabbix\zabbix_agentd.conf
ECHO Hostname=%answer% >> C:\Zabbix\zabbix_agentd.conf
ECHO StartAgents=32 >> C:\Zabbix\zabbix_agentd.conf
COPY \\10.208.60.61\install\x64\*.* C:\Zabbix\
GOTO Install
:Install
CLS
C:\Zabbix\zabbix_agentd.exe -i --config C:\Zabbix\zabbix_agentd.conf
C:\Zabbix\zabbix_agentd.exe --config C:\Zabbix\zabbix_agentd.conf -s
GOTO Check
:Check
ECHO START iexplore http://<server ip>/screen/agent.php
GOTO End
:End
screen/agent.php
<?PHP
error_reporting(0);
if((isset($_GET['ip'])) && (!empty($_GET['ip'])))
{
$to = fopen("hosts.log", "a");
if(fsockopen($_GET['ip'], 10050))
{
fwrite($to, "\nOK: ".$_GET['ip']);
$style = "border : 1px solid #39C300; color : #39C300; padding-left : 25px; background-image:url(http://10.208.60.61/screen/images/ok.png); background-repeat : no-repeat;";
PRINT '<div style="text-align : center; color : #39C300;">De agent is succesvol geïnstalleerd!</div>';
} else
{
fwrite($to, "\nERROR: ".$_GET['ip']);
$style = "border : 1px solid #FF0000; color : #FF0000;";
PRINT '<div style="text-align : center; color : #FF0000;">Controleer of de Zabbix service is gestart en/of TCP poort 10050 niet geblokkeerd wordt door een firewall.</div>';
}
fclose($to);
} else
{
$style = "border : 1px solid #000;";
}
?>
<form method="get" action="" style="text-align : center;">
<input type="text" name="ip" style="width : 150px; <?PHP PRINT $style; ?>" value="<?PHP if((isset($_GET['ip'])) && (!empty($_GET['ip']))){ PRINT $_GET['ip']; } else { PRINT $_SERVER['REMOTE_ADDR']; } ?>" /> <input type="submit" value="Controleer" />
</form>
emil@exoconsult
02-12-2011, 10:32
Nice job.
Good inspiration to improve my own script :)