Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 251579

Re: Monitoring View with Nagios

$
0
0

Hello,

 

here is my script thanks to six4rm fo his ProblemDesktops.ps1 , I was able monitor my view active session using nagios.

 

 

# This script will count the connected Desktops within a VMware View environment.

 

# Define Critical & Warning levels to alert back to Nagios.
$Critical = 10
$Warning = 8

 

###############################################################################################

# Set variables to 0
$Count = 0
$returnStateOK = 0
$returnStateWarning = 1
$returnStateCritical = 2

 

# Add VMware View PowerShell Snapin.
add-PSSnapin "VMware.View.Broker"

 

# Collect Desktop Information
ForEach ($Result in Get-RemoteSession -pool_id DS7 | Select state)
{
if ($Result.state -eq "CONNECTED")
{
  $Count = $Count + 1
}
elseif ($Result.state -eq "Error")
{
  $Count = $Count + 1
}
elseif ($Result.state -eq "Agent unreachable")
{
  $Count = $Count + 1
}
}

 

### PerformanceData Output
$NagiosPerfData = "|Active sessions=" + $Count + ";8;10"
$NagiosPerfData = $NagiosPerfData -replace " ", ""
$Users = ((Get-RemoteSession -pool_id DS7)|Where-Object{$_.state -eq "CONNECTED"}) | select duraTion, username #starTime
$Users = $Users -replace "", ""
#############################################################

 

if ($Count -ge $Critical)
{
#CRITICAL
Write-Host "Activesessions="$Count" "$Users" "$NagiosPerfData
     exit $returnStateCritical
}
elseif ($Count -ge $Warning)
{
#WARNING
Write-Host "Activesessions="$Count" "$Users" "$NagiosPerfData
     exit $NagiosStatus = 1
}
else
{
#OK
  Write-Host "Activesessions="$Count" "$Users" "$NagiosPerfData
  }
exit $NagiosStatus

 

##########################################################

 

right now I am looking to capture users who are trying to those Desktop Pool which is full already, the objective is to catch who are those users trying to login and send the information to the Admin... it sounds complicated.

 

this is the performance graph using nagios


Viewing all articles
Browse latest Browse all 251579

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>