Jump to content

PowerShell Module to manage configuration of Pulseway Manager


Przemyslaw Klys

Should development continue?  

2 members have voted

You do not have permission to vote in this poll, or see the poll results. Please sign in or register to vote in this poll.

Recommended Posts

A bit of introduction:

I'm a happy user of Pulseway Manager. I use Pulseway Manager Enterprise (but for this topic it doesn't really matter). I manage quite large deployment with 250 Pulseway monitored machines. Someone else installed (via GPO) and did some basic setup. After running basic setup for a while, someone else changed some settings and tweaked it a bit. Finally ... again someone said lets change things around... 

This got me to this point... I have to change:

CPU

  • For all servers CPU > 90% for 30minutes > CRITICAL

RAM

  • RAM on 1 HOST – 5% for 30 min > CRITICAL
  • Disable Low RAM on VM's
  • Disable Low RAM in Azure

Enable storage for any drives the servers have

  • 20GB free > ELEVATED
  • 10GB free > CRITICAL

While I could just assign some poor guy to go thru 60+ servers and change things, make sure those are correct I decided it's time to introduce PowerShell for those Active Directory admins out there... while I know there is Pulseway GPO but it's kind of limited, and doesn't give much flexibility (for example drive monitoring). It also overwrites settings set locally without Pulseway actually showing them on Client.  

After playing a bit...  I managed to write:

Clear-Host
Import-Module PSPulsewayManager -Force
 
### Tests - Account Page ###
Get-PulsewayMaintenanceMode
Set-PulsewayMaintenanceMode -Toggle $false -Verbose
Get-PulsewayGroupName
Set-PulsewayGroupName -GroupName 'EVOTEC' -Verbose
Get-PulsewayComputerName
Set-PulsewayComputerName -NewComputerName 'EVO1' -Verbose
 
### Set settings remotly...
 
$Computer = 'AD1'
Get-PulsewayMaintenanceMode -Computer $Computer
Set-PulsewayMaintenanceMode -Computer $Computer -Toggle $false -Verbose
Get-PulsewayGroupName -Computer $Computer
Set-PulsewayGroupName -Computer $Computer -GroupName 'EVOTEC' -Verbose
Get-PulsewayComputerName -Computer $Computer
Set-PulsewayComputerName -Computer $Computer -NewComputerName 'AD1' -Verbose

And another tab... 

Clear-Host
Import-Module PSPulsewayManager -Force
Import-Module PSWriteColor
 
### Tests - Notifications Performance Page ###
 
Write-Color ' Get ', 'CPU usage below', ' settings' -Color Yellow, Green, Yellow
Get-PulsewayCPUBelow
Write-Color ' Get ', 'CPU usage above', ' settings' -Color Yellow, Green, Yellow
Get-PulsewayCPUAbove
Write-Color ' Get ', 'Memory', ' settings' -Color Yellow, Green, Yellow
Get-PulsewayMemoryLow
Write-Color ' Get ', 'Port Closed', ' settings' -Color Yellow, Green, Yellow
Get-PulsewayMonitoredPortClosed
 
Set-PulsewayCPUAbove -CPUUsagePercentage 25 -CPUUsageTimeInterval 20 -PrioritySendNotificationOnCPUUsage Elevated -SendNotificationOnCPUUsage Enabled -Verbose
Set-PulsewayCPUBelow -BelowCPUUsagePercentage 2 -BelowCPUUsageTimeInterval 20 -PrioritySendNotificationOnBelowCPUUsage Elevated -SendNotificationOnBelowCPUUsage Disabled -Verbose
Set-PulsewayMemoryLow -LowMemoryPercentage 10 -LowMemoryTimeInterval 15 -PrioritySendNotificationOnLowMemory Critical -SendNotificationOnLowMemory Enabled -Verbose
Set-PulsewayMonitoredPortClosed -PortInterval 2 -PrioritySendNotificationOnPortNotAccessible Critical -SendNotificationOnPortNotAccessible Enabled -Verbose

And another tab

Clear-Host
Import-Module PSPulsewayManager -Force
Import-Module PSWriteColor
 
$Computer = 'AD1'
 
Write-Color 'Get ', 'Low Disk Space' -Color White, Yellow
$Drives = Get-PulsewayLocalDiskSpace -Computer $Computer
$Drives
Write-Color 'List ', ' drives separatly' -Color White, Yellow -LinesAfter 1
$Drives.MonitoredDrives
 
## Find all drives for computer/server
$FindDrives = Get-Drive -Computer $Computer
$FindDrives
$ListDrives = @()
# Set the settings for all drives for particular computer/server (Elevated)
$DrivesElevated = Set-DriveSettings -Drive $FindDrives -Percentage 10 -Priority Elevated -SizeMB 20000 -UsePercentage No
# Repeat process for same drives but make it critical
$DrivesCritical = Set-DriveSettings -Drive $FindDrives -Percentage 10 -Priority Critical -SizeMB 10000 -UsePercentage No
 
$ListDrives += $DrivesElevated
$ListDrives += $DrivesCritical
 
Set-PulsewayLocalDiskSpace -Computer $Computer -Drives $ListDrives -SendNotificationOnLowHDDSpace Enabled -Verbose

Since it covers my needs for now I was wondering if there is any interest in this? I don't want to spend time on it if there's no one else needing this :)

 

I've published it on github

https://github.com/EvotecIT/PSPulsewayManager

But its also published in PowerShellGallery which allows you to install it ....

Install-Module PSPulsewayManager

Import-Module PSPulsewayManager 

Use the commands.. Keep in mind I've not spent a ton of time on it. There are bugs, some things are not checked.. but it does work ;-) 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...