https://github.com/devblackops/pshealthz
Basic HTTP listener written in PowerShell that executes Operation Validation Framework (OVF) tests and returns results using a simple REST API
https://github.com/devblackops/pshealthz
Last synced: 3 months ago
JSON representation
Basic HTTP listener written in PowerShell that executes Operation Validation Framework (OVF) tests and returns results using a simple REST API
- Host: GitHub
- URL: https://github.com/devblackops/pshealthz
- Owner: devblackops
- License: mit
- Created: 2016-11-18T16:27:16.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2019-08-20T05:59:00.000Z (over 5 years ago)
- Last Synced: 2024-08-13T07:06:30.061Z (6 months ago)
- Language: PowerShell
- Homepage:
- Size: 41 KB
- Stars: 21
- Watchers: 7
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: .github/CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - devblackops/pshealthz - Basic HTTP listener written in PowerShell that executes Operation Validation Framework (OVF) tests and returns results using a simple REST API (PowerShell)
README
[](https://ci.appveyor.com/project/devblackops/pshealthz/branch/master)
# PSHealthZ
## Overview
Basic HTTP(S) listener that executes [Operation Validation Framework](https://github.com/PowerShell/Operation-Validation-Framework) (OVF) tests that are present on the given system and returns results using a simple REST API.
This is an implementation of the [Health Endpoint Monitoring Pattern](https://msdn.microsoft.com/en-us/library/dn589789.aspx) using PowerShell.## Getting Started
Start the listener on the desired port and path. The command below will expose a REST endpoint at ```http://localhost:1938/health```.
>This command must be run from an elevated session.
```powershell
>$listener = Start-HealthzListener -PassThru -Verbose
```This will create a PowerShell job running the listener in the backgound. To see the listener details, run:
```powershell
$listener | Format-List *
```To test the listener, run the following:
```powershell
>$r = Invoke-RestMethod -Uri 'http://localhost:1938/health'
>$r | Format-List *
```Without specifying a specific test to execute, PSHealthZ will return a list of available OVF tests that are present in `$env:PSModulePath`.
```powershell
>$r.availableTests
Storage Capacity Memory Capacity OVF.Example1
Services asdf OVF.Example2
More services OVF.Example2
Logical Disks OVF.Windows.Server
Memory OVF.Windows.Server
Network Adapters OVF.Windows.Server
Operating System OVF.Windows.Server
```To execute a specific test, add `'?test='` as a query parameter.
```powershell
>$r = Invoke-RestMethod -Uri 'http://localhost:1938/health?test=services'
```To execute tests from a specific module, add `'?module='` as a query parameter.
```powershell
>$r = Invoke-RestMethod -Uri 'http://localhost:1938/health?module=ovf.example1'
```You can inspect the test results with:
```powershell
>$r.testResults | Format-Table *
```To stop the HTTP listener, run:
```powershell
$listener | Stop-HealthzListener
```