Question

Just uploaded an updated copy of one of my old python scripts called "pingchecker" and thought I would share it. I wrote it several years ago to make it easier for me to clean up my Active Directory container. We had a lot of old machine names in our container that no longer pointed to active machines, but with several hundred machines actively under our control in that same container, I didn't want to just start arbitrarily deleting hostnames. On top of that, I wasn't there when the whole shebang was initially set up, so I didn't have a copy of all the active hostnames we were supposed to have, and I did a poor job of maintaining records of computer names when I would reimage computers. To find out which computers were active and which were not without manually walking around and looking at them all, I wrote this script. I then went into our Active Directory container and unchecked all of the columns except "hostname", and exported that to a text file with one hostname per line, then just copied and pasted those hostnames into the terminal when it asked for targets.  Actually the copy I used at work never asked for hostnames, it would just look for a text file by a particular name that I would create by exporting hostnames from Active Directory, but I modified this one to ask for them so it's more useful for everyday users. This made it very easy to copy and paste several hundred hostnames, then just hit enter and walk away, and have the results exported to a nice text file for me to look at when I got back. I ran the script 2 or 3 times over the course of a couple of weeks to allow for people who might have taken a machine on a trip or other anomalies, and that allowed me to find a pattern of machine names that were consistently offline so I could delete them and remove the clutter from our Active Directory OU.

This updated version has been converted from Python 2 to Python 3, and with this particular one you must have Python 3 installed to use it, Python 2 doesn't seem to like some of the error handling. I've also added colored text output while the script runs, so if you want to review the results while it's still running, or just watch it run, you'll get a colored highlight around the ping results of each target to help you pick out the important information while it's running.  I'm thinking about building in an option to export the results to a .csv file since they're just plain text files, that way you can open it with your favorite spreadsheet editor and sort long lists of hosts by their "Up" or "Down" status, but I haven't been to bed in almost 24 hours, so that'll be a project for another day, :p

It's in a tar.gz archive which you can extract with all sorts of free software like 7zip.

 

Download link: http://sourceforge.net/projects/pingchecker/files/PingChecker_15.8.15.tar.gz/download

Project page: https://sourceforge.net/projects/pingchecker/

I linked directly to the file because as of this post, SourceForge hasn't updated the download button on the project page to point to the newest version that I just now uploaded.

 

Screenshot: The results stored in a text file when it's done.

ping-results.thumb.png.d5d98fca995449260

Screenshot: The highlighted results you see while it's still running.

ping-terminal.thumb.png.c71892e5f999e85f

 

Edited by Gerowen
added tags
Link to comment
https://www.neowin.net/forum/topic/1268872-updated-pingchecker/
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Gonna see about updating it again to include some simple cross platform GUI options, and to ask the user if they want to read hosts from an existing file or if they want to enter them manually.  Started working on that this evening.

  • 0

Almost finished with another update.

I've added graphical dialogs to replace the terminal, although the terminal will still be shown in the background for you to monitor longer operations in real time, and so you can see any error messages spit out by your Python interpreter.

I've added the option to either enter some targets manually (graphical window of course), or select a file to read targets from (graphical as well).

I've added a function that exports the results to a CSV file as well as the plain text file so if you have Office software installed, you can open the CSV file as a spreadsheet and sort the results by IP address, Up/Down status, etc.

I've added a built-in graphical text viewer for displaying the results to the user in a more user friendly fashion for Linux users.  I was using the "sensible-editor" command, which usually defaults to the terminal based "nano" editor, to keep from having to type a kajillion "try, except" arguments since it's no telling whether a user will have GEdit or KWrite or Kate, etc. installed on Linux.

I've accomplished the goals I set out for today which were to make it graphical, add .csv file support, let the user choose whether to enter targets manually or read them from a file, and to display the results file graphically on all systems.  Right now I'm just reviewing everything to make sure I've accounted for possible errors and trying to make the code a little more efficient.

This is mostly just a little pet project for myself to get better at Python while improving on a tool I made for myself years ago.

Here's a screenshot of one of the graphical windows which embeds an image showing you how a file containing targets should look.  This immediately precedes the file selection dialog where you pick the file.

working-gui.thumb.png.af1313c1c921391e51

Edited by Gerowen
type-o
This topic is now closed to further replies.
  • Posts

    • (macOS) Screen zoom was broken for me in beta 1 and it's now working properly in beta 2. In terms of performance and UI design/consistency, these betas are already much better than Tahoe.
    • Less powerful than a PS5 at twice the price! I wonder if they use that for marketing? Totally DoA.
    • Astra 0.6.1 Beta by Razvan Serea Astra is an audiophile music player designed for local music libraries, supporting MP3, FLAC, WAV, AAC, OGG, M4A, OPUS, WMA, AIFF, and more via FFmpeg. It offers gapless playback with pre-buffering, multichannel audio remapping, and Dolby Atmos decoding, ensuring albums play seamlessly while maintaining high-fidelity sound. Astra features real-time DSP visualizers powered by a native C++ engine, including an oscilloscope, spectrum analyzer, and vectorscope. A fully parametric 10-band EQ with live frequency response, built-in presets, and AutoEQ headphone calibration import lets you precisely shape your sound. Playback controls include shuffle, repeat, and drag-and-drop queue management, while the library automatically extracts metadata, album artwork, and supports global search, favorites, and recently played tracking. Additional features include output device selection, delay calibration, customizable themes, fullscreen and mini-player modes, Discord Rich Presence, optional Last.fm scrobbling, and an opt-in local API for integrations. Astra delivers a complete, high-quality desktop audio experience with no telemetry, accounts, or streaming. Astra 0.6.1 Beta changelog: Lyrics Initial XLRC support via @boof2015/xlrc 0.2.0 (#131) XLRC sidecar scanning, manual import, and renderer support Word timing, furigana, translations, voice labels, and translation-priority controls for XLRC Fullscreen lyrics overhaul with additional layout polish Manual lyrics editor with LRC, XLRC, and plain-text modes Drag-and-drop lyrics import plus sync offset controls Clickable synced lyrics for seeking, with popout and transport lyrics updates (#138) Fixed lyrics info sidebar scrolling (#138) Added a workaround for LRCLIB instability Metadata & Library Metadata editor rebuilt as a side panel Virtual DB metadata overrides and optional direct file tag writing Bulk metadata editing for title, artist, album, album artist, genre, year, track/disc numbers, and artwork Undo/redo support for virtual metadata edits Clear overrides action and default save-mode preference Artist page grid view added, with later design and sizing refinements Improved Jump to Playing with smart source, queue, album, artist, and library track targets Fixed smart source jump behavior Playlists Fixed VLC-style M3U import failures (#127) Added playlist export to M3U/M3U8 (#118) Improved imported playlist path resolution and missing-entry preservation Shuffle added to playlist pages (#121) Remove tracks directly from playlist views (#128) Fixed create-playlist-from-track modal closing when clicking inside it (#137) Multi-select quality-of-life fixes Right-click context menus no longer clear multiselections UI & Navigation Fixed UI scaling regressions in sidebar and home surfaces (#122, #123) Fixed transport bar regression (#126) Fixed horizontal scrolling on Home and Library rails Fixed artist grid sizing while searching Updated playlist action buttons and related layout polish Additional fullscreen lyrics visual adjustments Visualization Scopes and visualizers now respect UI scaling settings (#155) Added shared canvas sizing logic for correct DPR/backing-store behavior Canvas sizing tests added for visualizer scaling regressions Discord RPC Discord Rich Presence activity structure refactored Compact status can prioritize title or artist Profile info line can show file info or album Title and artist links can target YouTube Music, Last.fm, or be disabled Optional small Astra badge for cover-art presence Configurable “clear when paused” timing Added Discord activity tests Scrobbling Fixed custom Last.fm2 API profiles being accidentally blocked Expanded scrobbler profile protocol handling coverage Stability & Tests Added/expanded tests for XLRC parsing, lyrics presentation, metadata editor state, playlist import/export path handling, artist grid layout, horizontal scrolling, canvas sizing, and Discord RPC activity building Download: Astra 0.6.1 Beta | 138.0 MB (Open Source) View: Astra Home Page | Github | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • How does it compare to the "SeeStar S30 Pro" and the "Vespera PRO 2"?
  • Recent Achievements

    • Week One Done
      Almohandis earned a badge
      Week One Done
    • Rookie
      dorf went up a rank
      Rookie
    • First Post
      mike_rumble earned a badge
      First Post
    • Dedicated
      tuben earned a badge
      Dedicated
    • Week One Done
      mnsgroup earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      500
    2. 2
      +Edouard
      209
    3. 3
      PsYcHoKiLLa
      100
    4. 4
      Michael Scrip
      85
    5. 5
      neufuse
      69
  • Tell a friend

    Love Neowin? Tell a friend!