Server Monitor (GUI Ping Tool with RDP and TRACERT)

Post your working scripts, libraries and tools
User avatar
Grendahl
Posts: 159
Joined: 30 Sep 2013, 08:21

Server Monitor (GUI Ping Tool with RDP and TRACERT)

13 Sep 2016, 08:41

EDIT:
Figured out that Elesar was the original author on this, and he's been updating it lately. Find the latest and greatest version here:
Elesar wrote:Github repo is here: https://github.com/DThomas44/Host-Monitor

I'm not sure who the original author was that I based this work on, as a search of the forums proved unsuccessful.

However, I'd like to thank whoever it was, and to share my modified version with the rest of you.

Image

http://www.grenfx.com/downloads/ServerMonitor.zip

Use is pretty simple, edit the HostList.txt file - one host on each line, and no blank line at the end.

I've left it in .ahk format, but if you'd like to compile the scripts and run it as an exe that's fine too. It's got the appropriate FileInstall lines so if you compile the main script last, it will include all the required files. Just make sure that the three locations where the other .ahk files are run from are changed to .exe before you compile the main.

Enjoy!
Last edited by Grendahl on 11 Oct 2016, 07:30, edited 1 time in total.
User avatar
Grendahl
Posts: 159
Joined: 30 Sep 2013, 08:21

Re: Server Monitor (GUI Ping Tool with RDP and TRACERT)

27 Sep 2016, 14:45

Be nice to know if anyone found this helpful?
Elesar
Posts: 69
Joined: 31 Oct 2013, 07:56

Re: Server Monitor (GUI Ping Tool with RDP and TRACERT)

30 Sep 2016, 14:19

Haha, looks like that is based off of one of my old scripts that I shared on IRC a while back :D

FYI, I have updated mine a bit differently than you have here, and I still use it daily.

Glad to see someone found it useful and as an inspiration for further development!

My newer version has:
  • Pseudo-Multi-Threading (launching a slave script that uses SendMessage/OnMessage to get results back to main script, up to 10 threads at a time currently).
    Last Seen time for offline hosts.
    Average ping time over last 10 ping attempts.
    Online/Offline/Next scan timer in status bar.
    Menu list for each host that includes RDP, TraceRoute, Browse, Browse (HTTPS), SSH & Telnet options (Uses putty for ssh/telnet sessions).
User avatar
Grendahl
Posts: 159
Joined: 30 Sep 2013, 08:21

Re: Server Monitor (GUI Ping Tool with RDP and TRACERT)

30 Sep 2016, 14:29

Elesar - I'm glad you spoke up! I couldn't find any reference to the original author that I'd borrowed this from. Thank you!

I'd also be interested in what you've done with it.
Elesar
Posts: 69
Joined: 31 Oct 2013, 07:56

Re: Server Monitor (GUI Ping Tool with RDP and TRACERT)

30 Sep 2016, 14:44

Here you go... I think I sanitized it from all my other random files and tests that were in the folder with it...
Just included the .ahk files for everything, so no compiled stuff to worry about.
If you decide to compile the main script, you should also compile both of the worker scripts in the inc folder (PingMsg and tracert).
For SSH/Telnet to function, you will need to have putty.exe in the inc folder. Get it here: http://www.chiark.greenend.org.uk/~sgta ... nload.html
The icons are from a google search for free stock icons, then modified slightly by myself. Don't have the original source for them anymore.

Oh, also forgot another of the new features. Mouse over a good ping result's host name to get a tooltip with the IP for that host.

Image

Download from Dropbox: https://dl.dropboxusercontent.com/u/925 ... onitor.zip

EDIT: Settings.xml has a handfull of things that can be changed.

maxThreads has little effect above 10, due to a delay I included in the checking loop due to missing messages on occasion.
checkInterval is how often in seconds to check all hosts status.
logLevel currently doesn't do much iirc.
pingAverageCount controls the array size for prior ping return times.
User avatar
Grendahl
Posts: 159
Joined: 30 Sep 2013, 08:21

Re: Server Monitor (GUI Ping Tool with RDP and TRACERT)

03 Oct 2016, 13:35

Thanks!

Any shot you can include a link to the double down arrow image?

Oh, and XGraph.ahk too? (Edit: Nevermind, found the lib)

Edit2: Fixed the issue that PingGraphTest was having. On line 53, change

Code: Select all

XGraph_Plot(pGraph1, strReplace(reply[3], "ms"))
to

Code: Select all

XGraph_Plot(pGraph1, 100-strReplace(reply[3], "ms"))
and it will display properly.
Elesar
Posts: 69
Joined: 31 Oct 2013, 07:56

Re: Server Monitor (GUI Ping Tool with RDP and TRACERT)

04 Oct 2016, 13:07

The double down arrow is a character: chr(9196) on line 137.
Not sure which font this is from, but it is there on a fresh Win10 installation by default (I just re-installed today at work and it shows properly).

Haha, thanks for the graph fix...I thought I had taken all of that out, not sure how I want to implement that, or if it will be in this script at all, or another of my network monitoring scripts (I have a few).
User avatar
Grendahl
Posts: 159
Joined: 30 Sep 2013, 08:21

Re: Server Monitor (GUI Ping Tool with RDP and TRACERT)

04 Oct 2016, 13:20

Figured out that it was a unicode character. Unfortunately, it doesn't exist on the box this runs on (Win7) so I just replaced it with a + instead.
I saw the graph test, so figured I'd add it to the menu items and fix the issue. Works fine now, though I've tweaked my version a touch.

Updated Host Monitor.ahk context menu to add the item to it, and updated the contextmenuhandler to handle it. I like what you've done with that, by the way.

Also, here's the updated pinggraph.ahk:

Code: Select all

#SingleInstance, Force
#NoEnv
ListLines, Off

;<=====  Startup  =============================================================>
;Receive messages from slave scripts
OnMessage(0x4a, "Receive_WM_COPYDATA")

;Allcate console so we don't have constant flashing windows while pinging
DllCall("AllocConsole")
WinHide % "ahk_id " DllCall("GetConsoleWindow", "ptr")

;<=====  User Input  ==========================================================>
;InputBox, host,, Input hostname or IP to monitor.
host = %1%

;<=====  GUI  =================================================================>
Gui, Margin, 10, 10
Gui, Font, s8, Verdana
Loop, % 11 + ( Y := 15 ) - 15 ; Loop 11 times (create X axis labels)
    Gui, Add, Text, xm y%y% w22 h10 0x200 Right, % 125 - (Y += 10)
ColumnW := 10
hBM := XGraph_MakeGrid(  ColumnW, 10, 40, 12, 0x008000, 0, GraphW, GraphH )
Gui, Add, Text, % "xm+25 ym w" ( GraphW + 2 ) " h" ( GraphH + 2 ) " 0x1000" ; SS_SUNKEN := 0x1000
Gui, Add, Text, xp+1 yp+1 w%GraphW% h%GraphH% hwndhGraph1 0xE, pGraph1
pGraph1 := XGraph( hGraph1, hBM, ColumnW, "1,10,0,10", 0x00FF00, 1, True )
Gui, Add, StatusBar
SB_SetParts( 35 )
Gui, Show,, XGraph Ping %host%
Loop, 100
    XGraph_Plot(pGraph1, A_Index)
SetTimer, Ping, 1000
Return

;<=====  Hotkeys  =============================================================>
F1::XGraph_Info(pGraph1)

;<=====  Labels  ==============================================================>
GuiClose:
    ExitApp

Ping:
    Run, % A_ScriptDir . "\inc\PingMsg.ahk """ . A_ScriptName . """ "
                . host . " " . A_Index,, Hide, threadID
    Return

;<=====  Functions  ===========================================================>
Receive_WM_COPYDATA(wParam, lParam){
    Global
    StringAddress := NumGet(lParam + 2*A_PtrSize)
    CopyOfData := StrGet(StringAddress)
    reply := StrSplit(CopyOfData, "|")
    if (reply[3] != "TIMEOUT")
    {
        ;Good return
        XGraph_Plot(pGraph1, 100-strReplace(reply[3], "ms"))
        SB_SetText( reply[3], 2 )
        ;ToolTip, % strReplace(reply[3], "ms")
    } else {
        ;Timeout
        XGraph_Plot(pGraph1, 9999)
        SB_SetText( reply[3], 2 )
    }
    return true
}

;<=====  Includes  ============================================================>
#Include %A_ScriptDir%\inc
#Include Common Functions.ahk
#Include XGraph.ahk
User avatar
hoppfrosch
Posts: 406
Joined: 07 Oct 2013, 04:05
GitHub: hoppfrosch
Location: Rhine-Maine-Area, Hesse, Germany
Contact:

Re: Server Monitor (GUI Ping Tool with RDP and TRACERT)

05 Oct 2016, 00:41

Really nice!

What about generating a RealTime-Plot of the ping times using XGraph?
Elesar
Posts: 69
Joined: 31 Oct 2013, 07:56

Re: Server Monitor (GUI Ping Tool with RDP and TRACERT)

05 Oct 2016, 08:18

hoppfrosch wrote:Really nice!

What about generating a RealTime-Plot of the ping times using XGraph?
I've done just that in my local copy as this thread has kicked me into working on this script again.

Image

Still implementing the logging part of it, as I ran out of time yesterday, but once I have that implemented and everything else cleaned up, I'll upload a new version of it.

Grendahl: If you have any more suggestions or improvements, we can work together on this to make it better. It currently does all that I need it to, but we can add functionality as needed. I do plan on adding a proper settings GUI and a more streamlined way to add/remove hosts, but other than that I don't have any ideas for more features.
User avatar
Nextron
Posts: 1376
Joined: 01 Oct 2013, 08:23
Location: Netherlands OS: Win10 AHK: Unicode x32

Re: Server Monitor (GUI Ping Tool with RDP and TRACERT)

05 Oct 2016, 14:25

It would be nice it a (small) graph is in the same window, next to the colored blocks. 8-)

It didn't show any times for me. I'm guessing it's a localization issue, as for my ping results in Dutch there is a space between my ping time and units; eg: 12 ms instead of 12ms. Changing line 55 in PingMsh.ahk to RegExMatch(A_LoopField, "O)(?=|<)\d* ?ms", time) fixes that.

Also, I'm questioning the usefulness of the yellow color update during updating. I would associate a change in color with a change in availability of the server and yellow with minor issues.
Elesar
Posts: 69
Joined: 31 Oct 2013, 07:56

Re: Server Monitor (GUI Ping Tool with RDP and TRACERT)

05 Oct 2016, 15:37

Nextron wrote:It would be nice it a (small) graph is in the same window, next to the colored blocks. 8-)

It didn't show any times for me. I'm guessing it's a localization issue, as for my ping results in Dutch there is a space between my ping time and units; eg: 12 ms instead of 12ms. Changing line 55 in PingMsh.ahk to RegExMatch(A_LoopField, "O)(?=|<)\d* ?ms", time) fixes that.

Also, I'm questioning the usefulness of the yellow color update during updating. I would associate a change in color with a change in availability of the server and yellow with minor issues.
I may look into adding a graph next to the color block, though honestly I have a different program for intensive monitoring of critical systems that runs a continual graph, so I hadn't even given that thought before. (not a script, a 3rd party application)

I'll update my script with your changes for localization.

I had originally planned on doing yellow for "above average ping" or something like that, but in troubleshooting some issues with the script I changed it to show that a host was currently being checked and never changed it back. I'll look into changing this over at some point.
User avatar
Grendahl
Posts: 159
Joined: 30 Sep 2013, 08:21

Re: Server Monitor (GUI Ping Tool with RDP and TRACERT)

06 Oct 2016, 07:34

Elesar,

Sure, I'd be up for some cooperative work on this. I've already started adding some of the features that I have in my version to a copy of your version.

For me, perhaps the most important it being able to resize the GUI by determining how many rows it should display. I have yet to figure out how to properly anchor the settings on my version, but I think that placing them in menus would solve the issue.

Logging is also important, and my log function seems to work just fine for this. I also like the ability to automatically kick off a tracert and log the results of that on any failures.
Elesar
Posts: 69
Joined: 31 Oct 2013, 07:56

Re: Server Monitor (GUI Ping Tool with RDP and TRACERT)

06 Oct 2016, 09:31

Grendahl,

I've started to implement settings in a menu system. They are non-functional at the moment, but the menu is there. Check marks are driven off of the settings.xml file. I should be able to finish implementing the existing settings today while at work if nothing major happens that I have to go fix :D

Image

I'll also get auto tracert on ping failure implemented as I do the settings, as it should be simple to do. Anything else I can pull from your version I will do as well.

I'll try to upload a new version today if possible.
User avatar
Grendahl
Posts: 159
Joined: 30 Sep 2013, 08:21

Re: Server Monitor (GUI Ping Tool with RDP and TRACERT)

06 Oct 2016, 10:27

Looks great!
You could probably use some of the gui components from my settings items for your new settings gui.
FYI - I only log on failures. No sense in logging all the successes. :)
Elesar
Posts: 69
Joined: 31 Oct 2013, 07:56

Re: Server Monitor (GUI Ping Tool with RDP and TRACERT)

06 Oct 2016, 14:29

Did a few changes today:
  • Moved CheckHosts to function (global func)
    Implemented settings menu
    Implemented remembering window pos & setting
    Added Reload option to File menu
    Update About window (still not really done properly)
    Corrected for localizations that have a space after ping times (PingMsg.ahk line 55)
    Moved settings.xml to inc folder
    Added transform.xslt to inc folder
    Added LoadXML()
    Added SaveSettings()
    Changed reading of settings.xml to use LoadXML()
    Changed settings to work directly in xml doc rather than a secondary object
    Removed settings array from debug command as a result of the above change
    Implemented saving settings using SaveSettings()
    Added checking to ensure setting for rows doesn't exceed monitor area (guiRows > maxRows)
    Implemented AutoTraceRt
Updated download: https://dl.dropboxusercontent.com/u/925 ... onitor.zip
User avatar
jNizM
Posts: 2661
Joined: 30 Sep 2013, 01:33
GitHub: jNizM
Contact:

Re: Server Monitor (GUI Ping Tool with RDP and TRACERT)

07 Oct 2016, 00:43

This is maybe interesting for you guys -> Ping4 - IPv4 ping function

How about host on github?
[AHK] 1.1.32.00 x64 Unicode | [WIN] 10 Pro (Version 2004) x64 | [GitHub] Profile
Donations are appreciated if I could help you
Elesar
Posts: 69
Joined: 31 Oct 2013, 07:56

Re: Server Monitor (GUI Ping Tool with RDP and TRACERT)

07 Oct 2016, 08:14

jNizM wrote:This is maybe interesting for you guys -> Ping4 - IPv4 ping function

How about host on github?
Thanks, I'll look into that function.

As for github...if I can manage to wrap my head around the workflow this time, sure. I've tried source code management systems in the past and it always ends up with me doing more work to get that working that writing the script/program itself, so I never really bother with them :/ Something just doesn't quite click for me when trying to use them...
Elesar
Posts: 69
Joined: 31 Oct 2013, 07:56

Re: Server Monitor (GUI Ping Tool with RDP and TRACERT)

07 Oct 2016, 17:11

Ok, I think I have the whole github thing figured out. I'll update with a link when I get home.

I re-worked some stuff in receiving messages that looks to have improved reliability quite a bit, though I haven't tested very in depth yet. Still getting a few missed messages.
Changed the yellow box to indicate a higher than threshold latency or a missed message (thread returned while main scrip busy), so more of a "potential issue" indicator now.
Changed tracking of threads & thread count over to an object instead of just a counter.
Implemented a function to "time out" listening for threads that returned while we were otherwise occupied, setting their related host indicators to yellow. This function is triggered at 1/2 of the scan delay setting.

Return to “Scripts and Functions”

Who is online

Users browsing this forum: robodesign and 26 guests