Skip to content

Commit

Permalink
Directory Exist (#57)
Browse files Browse the repository at this point in the history
* added directory check plugin and updated README file

* adding README

* updated Changelog0

* added space at end of file

* removed version

* fixing up merge conflicts
  • Loading branch information
patricewhite authored and majormoses committed May 10, 2018
1 parent bc6443f commit f9e38f4
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ Which is based on [Keep A Changelog](http://keepachangelog.com/)

## [Unreleased]

### Added
- check-windows-directory.ps1, added plugin to check if a directory exist (@patricewhite).

## [2.7.0] - 2018-05-09
### Changed
- check-windows-event-log.ps1, added plugin to check for pattern and returns the number criticals and warnings that match that pattern (@patricewhite)
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ These files provide basic Checks and Metrics for a Windows system.
* bin/powershell/metric-windows-processor-queue-length.ps1
* bin/powershell/metric-windows-ram-usage.ps1
* bin/powershell/metric-windows-uptime.ps1
* bin/powershell/check-windows-directory.ps1
* bin/powershell/check-windows-event-log.ps1
* bin/powershell/check-windows-log.ps1

Expand Down
33 changes: 33 additions & 0 deletions bin/powershell/check-windows-directory.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<#
.SYNOPSIS
Checks if directory exist
.DESCRIPTION
Checks if directory exist
.Notes
FileName : check-windows-directory.ps1
Author : Patrice White - [email protected]
.LINK
https://github.com/sensu-plugins/sensu-plugins-windows
.PARAMETER LogName
Required. The name of the directory.
Example -Dir C:\Users\dir
.EXAMPLE
powershell.exe -file check-windows-directory.ps1 -Dir C:\Users\dir
#>

[CmdletBinding()]
Param(
[Parameter(Mandatory=$True)]
[string]$Dir
)

$ThisDir = Test-Path -Path $Dir

#Shows diretory if it exist
if ($ThisDir) {
"CheckDirectory OK: Directory exist"
EXIT 0
}else {
"CheckDirectory CRITICAL: Directory doesn't exist"
EXIT 2
}

0 comments on commit f9e38f4

Please sign in to comment.