Commit ed9a88ec by JR Dalrymple

This kind of works

parent b98184a5
......@@ -11,19 +11,52 @@
#
#################################################################################
if ( (Get-PSSnapin -Name Citrix.XenApp.Commands -ErrorAction SilentlyContinue) -eq $null )
{
Add-PSSnapin Citrix.XenApp.Commands
$nscpBinary = "c:\program files\NSClient++\nscp.exe"
$returnCode = "3" #Unknown by default
$nagiosHost = "mn-lx9.gsellc.local" # this is the host running the NSCA daemon
$encryption = "3des" # set this to match nsca.cfg on the Nagios host
$payloadLength = "4096" # set this to match your nsca daemon, the default is 512
$nscaPassword = "somepassword" # set this to match nsca.cfg on the Nagios host
$sourceHost = "CitrixFarm" # This needs to match the host you have configured in Nagios for these passive checks
$userStringArray = @()
function nagiosExit($returnCode, $statusOutput) {
Write-Host $statusOutput
Exit $returnCode
}
function sendNscaExit($returnCode, $statusoutput) {
}
if ( (Get-PSSnapin -Name Citrix.XenApp.Commands -ErrorAction SilentlyContinue) -eq $null ) {
Add-PSSnapin -Name Citrix.XenApp.Commands -ErrorAction SilentlyContinue
if ( (Get-PSSnapin -Name Citrix.XenApp.Commands -ErrorAction SilentlyContinue) -eq $null) {
nagiosExit "2" "Unable to load necessary Citrix PowerShell Snapins"
}
}
$sendNscaBinary =
$loggedOnUsers =
$returnCode = 3 #Unknown by default
$loggedOnUsers = Get-XASession -full | where-object { ($_.ApplicationState -eq 'Active') } | select AccountName
function sendNscaExit($returnCode, $statusoutput) {
}
foreach ($user in $loggedOnUsers) {
$userString = $user.AccountName
$userStringArray += $userString -replace '^.*\\',''
}
$userStringArray = $userStringArray | Select -Unique
foreach ($user in $userStringArray) {
$nscpArgs = @("nsca",
"host=$nagiosHost",
"command=$user",
"message=user $user is currently online",
"result=OK",
"encryption=$encryption",
"payload-length=$payloadLength",
"password=$nscaPassword",
"source-host=$sourceHost")
&$nscpBinary $nscpArgs
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment