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 curl.zip with ssl and unzip curl.exe where you want it. Here is link: http://curl.haxx.se/download.html
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
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
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 google.com 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.
EDIT:
If you want bat script to work with https. Then just add -k flag to curl command like this:
Create .vbs script
Then create .vbs file so you can run .bat file schedulet in background. Without everytime poping up on your screen
Add to “C:\Directory" your path to serverTesterScript.bat so .vbs file will found it.
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.
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.