Code Monkey home page Code Monkey logo

monitorfactory's Introduction

MonitorFactory

Monitor Factory is a small and lightweight PowerShell utility that generates near-real-time monitors for any data resources you like. All you need do is

  • figure out how to collect what you want in PowerShell (and PowerShell is rich enough and expressive enough to allow you to grab data about most anything on your computer), and then
  • feed that code as a script block to Monitor Factory to generate a monitor for continual update and display.

Installation

  1. If you have Windows 10 or later (or have updated your PS 3 or 4 environment with PowerShellGet), you can just run Install-Module -Name MonitorFactory to install this module from the PowerShell Gallery. Otherwise, you can download it from GitHub. After downloading, unzip MonitorFactory-master.zip into your PowerShell Modules directory ($env:UserProfile\Documents\WindowsPowerShell\Modules) and drop the "-master" suffix on the extracted folder.
  2. Import the module in your profile or import it manually: Import-Module MonitorFactory

Usage

See extensive help available from the cmdlet itself: Get-Help Start-Monitor Also see some practical examples and detailed notes on how to use it on Simple-Talk.com: Build Your Own Resource Monitor in a Jiffy

Here's a sample of what the output looks like: MonitorFactory sample with callouts

Wrappers

It is often convenient to create a wrapper for a monitor or set of monitors that you want to revisit frequently. Then, instead of having to type all this...

Start-Monitor { 
    Invoke-Sqlcmd -InputFile TopTwentyQueries.sql -Server localhost -Database master
} -AsJob -Interval 5sec -DisplayName 'Longest Running Queries'

you could use the much more compact

Start-SqlMonitor TopTwentyQueries.sql localhost master 'Longest Running Queries'

The distribution includes a Wrappers folder that contains Start-SqlMonitor and others--please contribute yours if you come up with something useful!

monitorfactory's People

Contributors

msorens avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

monitorfactory's Issues

Prior data color indicator not resetting on data refresh

Start-Monitor lets you flip between the current data set and the penultimate data set for simple comparison purposes. When you switch to the prior data set (Ctrl+D), the row count indicator box changes color to give a visual indicator. However, when the data refreshes (either automatically or manually) the displayed data set is now current but the row count indicator erroneously remains highlighted.

When running -AsJob, imports are only recognized if terminated with a semicolon

When generating a monitor as a background job (via -AsJob), the system has to understand your imports defined by Add-PSSnapin and Import-Module. These must precede any other code and should be recognizable when terminated either by a line break or a semicolon. V1.0.0. is only accepting the semicolon, though.

Example:
This fails because two of the three imports are using line breaks:

Start-Monitor -AsJob { 
    Add-PSSnapin Microsoft.TeamFoundation.PowerShell
    import-module foo.bar; 
    import-module xyz
    Get-StaleTfsFiles C:\MyTfsRoot\Trunk 
}

DataGridViewAutoSizeColumnMode type not found

After removing AsJob = $true in sqlmonitor.ps1, received an unknown type error.

Unable to find type [DataGridViewAutoSizeColumnMode].
At ...\PowerShell\Modules\MonitorFactory\Components\Start-Monitor.ps1:506 char:22

  •         $_.AutoSizeMode = [DataGridViewAutoSizeColumnMode]::None
    
  •                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (DataGridViewAutoSizeColumnMode:TypeName) [], RuntimeException
    • FullyQualifiedErrorId : TypeNotFound

I had to fully qualify DataGridViewAutoSizeColumnMode at line 506 in start-monitor.ps1

$_.AutoSizeMode = [System.Windows.Forms.DataGridViewAutoSizeColumnMode]::None

Was I doing something wrong and did my "fix" actually fix something, or did some other cosmic event take place that made it run without throwing an error?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.