Created
February 13, 2015 09:22
-
-
Save rudibroekhuizen/fea8b99fb689903b1d36 to your computer and use it in GitHub Desktop.
Logstash WMI input
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Author: [email protected] | |
# | |
# C:/Temp/metrics.ps1: | |
# Get-WmiObject Win32_LogicalDisk | Where-Object { $_.DeviceID -eq "C:" } | Select-Object SystemName, Caption, FreeSpace | convertto-json -Compress | Out-File -Append -NoClobber "C:/Temp/metrics.json" -encoding utf8 | |
# Get-WmiObject Win32_OperatingSystem | convertto-json -Depth 1 -Compress | Out-File -Append -NoClobber "C:/Temp/metrics.json" -encoding utf8 | |
# Get-WmiObject Win32_PerfFormattedData_PerfOS_System | convertto-json -Depth 1 -Compress | Out-File -Append -NoClobber "C:/Temp/metrics.json" -encoding utf8 | |
# | |
input { | |
exec { | |
command => "@powershell -NoProfile -ExecutionPolicy unrestricted -File C:/Temp/metrics.ps1" | |
interval => 60 | |
} | |
file { | |
path => "C:/Temp/metrics.json" | |
codec => json | |
tags => [ "logstash-win-base-20" ] | |
} | |
} | |
output { | |
elasticsearch { | |
cluster => "cluster-02" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You need PowerShell version 4.