How to remotely monitor Linux server from Windows

I’m using Ubuntu 12.04 on my server computer and on my local computer I use Windows 8.1
If you use Linux on your local computer here is tutorial how to get that working
Simple script to remotely monitor LAMP on server


This is tutorial how to monitor LAMP on Linux server remotely from Windows. I’m creating two scripts and schedule them to connect to my server in every 30minutes. If something goes wrong with the connection Windows shows notification something is wrong.

Server working correctly

In my previous tutorial I showed how to get your server side working correctly: Simple script to remotely monitor LAMP on server

Do these steps so you can get your server side working:
Create mysql user to server
Create tester php file to server
Create new site to Apache in server

Downloadin Curl and testing it

When you have your server side working get Curl to your Windows computer.

Go get the with ssl and unzip curl.exe where you want it. Here is link:
I downloaded: Win64 ia64 zip 7.33.0 binary SSL

Then you can run curl on you cmd. To test if it runs correctly.
“C:\Directory\Curl\” is your path where you saved curl.exe

local$ C:\Directory\Curl\curl.exe

If you get error message
“The Program can’t start becuase MSVCR100.dll is missing from your computer. Try reinstalling the program to fix this problem.”
You need to install Microsoft Visual C++ Redistributable Package. Depending on the version of Windows what you need to install. You can find different versions in here:
The Program can’t start because MSVCR100.dll is missing
I downloaded: Microsoft Visual C++ 2010 Redistributable Package (x64)

Create .bat script

Create .bat file and open notepad

local$ type NUL > serverTesterScript.bat
local$ notepad serverTesterScript.bat

Now you can create bat script what connects to your server and checks if server is working. If it’s not it notifies you with popup window. It also checks if you can ping so you can be sure your internet connection is on. If ping doesn’t work to Google script assumes you don’t have internet connection so it goes to end and doesn’t do nothing.

ping -n 1 -w 1000
if errorlevel 1 (
	goto End
set var=empty
for /f "delims=" %%a in ('C:\Directory\Curl\curl.exe -s') do @set var=%%a
if not "%var%"=="works " (
		start "" cmd /c "echo Something wrong with the server&echo(&pause"

If you want bat script to work with https. Then just add -k flag to curl command like this:

for /f "delims=" %%a in ('C:\Directory\Curl\curl.exe -s -k') do @set var=%%a

Create .vbs script

Then create .vbs file so you can run .bat file schedulet in background. Without everytime poping up on your screen

local$ type NUL > serverTesterScript.vbs
local$ notepad serverTesterScript.vbs

Add to “C:\Directory\” your path to serverTesterScript.bat so .vbs file will found it.

Set WshShell = CreateObject("WScript.Shell")
WshShell.Run chr(34) & "C:\Directory\serverTesterScript.bat" & Chr(34), 0
Set WshShell = Nothing

Schedule task to run every 5min

Schedule .vbs file run every 5 minutes. So we can test it.

Open “Task Scheduler” and create “Basic Task”


Create basic task that runs every day and runs your serverTesterScript.vbs script.

Then go your created task properties and edit task so it is repeated every 5 minutes so you can test that your script is really working

Test script

Go to your server and test these. Of course you have to wait 5 minutes every time to be sure your script really runned.

server$ mv public_html/tester/index.php public_html/tester/index.php2


server$ mv public_html/tester/index.php2 public_html/tester/index.php
server$ sudo service apache2 stop


server$ sudo service apache2 start
server$ sudo service mysql stop


server$ sudo service mysql start

Start using

Now you have tested your script and now you can start using it.

Schedule task to run every 30 minute.

Now you have script that checks every 30 minute if your server is working. If something goes wrong it notifies you.