Menu

Virtual Geek

Tales from real IT system administrators world and non-production environment

PowerShell HTML based Live Ping Monitor Demo

This is small demo where I combined PowerShell + HTML to create a dashboard report for ping. Basically what it does is?  when you put some servers entries in Pinglist.txt file which you want to ping and start a PowerShell Get_PingData.ps1 script. It shows the Live Dashboard on HTML web page as per server list. When you hover on any of the server, it will show more information such as IP address. 

Other useful article based on this: PowerShell HTML Server Racks Cabinet Live Diagram maker Demo

Microsoft PowerShell iis secure internation information services live ping monitor configuration html css javascript beautifull dashboard report web browser free freelancer.png

Below is the small demo video about this script. Ping result boxes are dynamic and are added or removed as per the servers in Pinglist.txt automatically. This dashboard is not only limited to ping, you can monitor services and other object with modifying PowerShell Script.

 

How to implement this script?

To use this app you will need to host the files (shared on github) on a Web Server. As web server I am using Microsoft Windows IIS (Internet Information Services) web server. As a first step I will install it from a scratch on Windows server.

Search and Open Windows PowerShell - Run as administrator.

Microsoft PowerShell Run as administrator different user Html CSS javascript configuration code for live ping monitor online iis server web based.png

Next run below command to install IIS (Internet Information Services) web server and its components. It doesn't need Reboot/Restart and Exit code should be Success and Success should be True after running command.

Install-WindowsFeature Web-WebServer, Web-Common-Http, Web-Default-Doc, Web-Dir-Browsing, Web-Http-Errors, Web-Static-Content, Web-Health, Web-Http-Logging, Web-Performance, Web-Stat-Compression, Web-Security, Web-Filtering, Web-Mgmt-Tools, Web-Mgmt-Console -IncludeManagementTools

Microsoft Powershell html css javascript run as administrator install-windowsfeature  common http features IIS web web-server configuration wev-mgmet-console tool.png

Download the HTML and PowerShell code zip file from my github account.

$zipUrl = 'https://github.com/janviudapi/PowerShell/raw/master/HTML/Web_Based_Live_Ping_Monitor_Dashboard/live4.1.zip'

Invoke-WebRequest $zipUrl -OutFile $home\Downloads\live4.1.zip

Microsoft Powershell zip url github Web based live ping monitor dashboard invoke-webrequest download zip html css javascript master main.png

When IIS is install, it's default website and component contents are installed and configured under folder C:\inetpub. Folder wwwroot is web root folder where html static file exist. 

Extract downloaded live.4.1.zip file under C:\inetpub\wwwroot\live. Basic Web Server and  HTML configuration is done.

Microsoft PowerShell run as Administrator downloads ls dir get-childitem expand-archive get-pingdata html css javascript report dashboard dynamic web page be url iis webserver.png

There is a file Get_PingData.ps1 in the folder, unblock it (This file came from another computer and might be blocked to help protect your computer).

Microsoft Powershell unblock-file -path get ping data html css javascript web server internet information services iis server configuration inetpub wwwroot live ping monitor.png

I have highlighted the files and folder structure for better understanding. Only yellow highlighted file I am going to edit, and execute red highlighted Ps1 script.

Microsoft IIS infromation internet services web server inetpub wwwroot live ping monitor ping list servers html css styles img javascript js database json powershell microsoft automation dashboard report html index.html.png

Next open the Pinglist.txt file and add your servers which you want to ping, all the servers are docker containers.

Microsoft Powershell PingList configuration web server iis server internet information services pinglist server html iis css javascript index powershell report dashboard configration.png

You are all set to execute Get_PingData.ps1 file (no changes are required in this script file), I have written this script for PowerShell Version 7, if incase you don't have v7 installed on you IIS server, you can download and install it using below commands. This will setup your environment.

$powershellDownbload = 'https://github.com/PowerShell/PowerShell/releases/download/v7.3.4/PowerShell-7.3.4-win-x64.msi'
$msiPath = "$home\Downloads\PowerShell.msi"

(New-Object System.Net.WebClient).DownloadFile($powershellDownload, $msiPath)
$tmpFileName = [System.IO.Path]::GetTempFileName()

Star-Process msiexec -ArgumentList "/i $msiPath /qn /L*v $tmpFileName" -NoNewWindow -Wait

Microsoft PowerShell download file https github msi powershell system.net.webclient system.io.path start-process msiexec html css javascript configuration.png

Once PowerShell is installed, Next search for PowerShell 7 and Run as administrator.

Microsoft Powershell 7 Installation automated silent open program powershell html css javascript program dashboard report configuration run as administrator search.png

Execute below command to start collecting ping data. Basically it collects the data and keep it in a file with JSON format and keep on updating it until you stop the ps1 script.

. C:\inetpub\wwwroot\live\Get_PingData.ps1

Microsoft Powershell ad administror pwsh ping interation beatiful dashboard powershell html css javascript configuration iis server information internet services configuration free install-features wwwroot.png

You can watch and monitor your dashboard now in browser with http://localhost_ip_fqdn/live. As you modify the pinglist.txt file as the dashboard will update it self according to list. 

Microsoft PowerShell iis secure internation information services live ping monitor configuration html css javascript beautiful dashboard report web browser free freelancer.png

Download this script live_ping_monitor.zip here or it is also available on github.com/janviudapi.

Useful Articles
Powershell adding leading zeros to string or int
PowerShell convert string to base64 value
PowerShell Encode or Decode an WebURL
Create an interactive HTML report with PowerShell data
Executing PowerShell script from PHP HTML web server
Send system disk space utilization HTML report Email using PowerShell
Send Email using PowerShell with .net object System.Net.Mail.MailMessage
 

Go Back



Comment

Blog Search

Page Views

12056169

Follow me on Blogarama