We're Hiring!
Take the next step in your career and work on diverse technology projects with cross-functional teams.
LEARN MORE
Mountain West Farm Bureau Insurance
office workers empowered by business technology solutions
BLOG
9
2
2019
3.1.2023

Checking the Progress of Beekeeper Execution Jobs

Last updated:
9.16.2020
3.1.2023
No items found.

We have received requests to see more detail around what is happening while Beekeeper applies patches for devices.  We have built a PowerShell script to query Beekeeper and the patched devices to display what is going on within Beekeeper and show the progress on individual patches.

To execute the script, you can run it on the Beekeeper server:

PS C:\_scripts> .\BK_CheckExecutionJobs.ps1


If you wish to run this script remotely, you will need to change the “localhost” references to your Beekeeper server name: (Ex: localhost to “JFHLABBK01”)

Before edit:

$ExecutionJobsRequestURI =
"http://localhost/BeekeeperApi/OPAS.svc/PatchRecords?`$filter=Status eq 'Running'"
$RunningJobsResults = Invoke-RestMethod -Uri $ExecutionJobsRequestURI -UseDefaultCredentials -Headers $URI_Headers
If($RunningJobsResults.value.Count -gt 0)
{
Write-Host "Current Beekeeper Execution Jobs:" -ForegroundColor Yellow
Write-Host " "
Foreach($Record in $RunningJobsResults.Value)
{
If($Record.'odata.type' -eq "OPASSvc.ClusterPatchRecord")
{
$Clustersrequesturi = "http://localhost/BeekeeperApi/OPAS.svc/Clusters?`$filter=ClusterId eq " + $Record.ClusterId
$Clusterresults = Invoke-RestMethod -Uri $ClustersrequestUri -UseDefaultCredentials -Headers $URI_Headers
Write-Host " Group currently Executing: " $Clusterresults.value.ClusterName " Node count: " $Record.NodeCount -ForegroundColor Cyan
}
If($Record.'odata.type' -eq "OPASSvc.NodePatchRecord")
{
$NodeRequestURI = "http://localhost/BeekeeperApi/OPAS.svc/ClusterNodes?`$filter=NodeId eq $($Record.NodeId)"
$NodeResults = Invoke-RestMethod -Uri $NodeRequestURI -UseDefaultCredentials -Headers $URI_Headers
Write-Host " On Node: " $NodeResults.value.NodeName -ForegroundColor Green
$EventRequestURI = "http://localhost/BeekeeperApi/OPAS.svc/Events?`$filter=(NodePatchRecordId eq $($Record.RecordId))"

After edit:

$ExecutionJobsRequestURI =
"http://JFHLABBK01/BeekeeperApi/OPAS.svc/PatchRecords?`$filter=Status eq 'Running'"
$RunningJobsResults = Invoke-RestMethod -Uri $ExecutionJobsRequestURI -UseDefaultCredentials -Headers $URI_Headers
If($RunningJobsResults.value.Count -gt 0)
{
Write-Host "Current Beekeeper Execution Jobs:" -ForegroundColor Yellow
Write-Host " "
Foreach($Record in $RunningJobsResults.Value)
{
If($Record.'odata.type' -eq "OPASSvc.ClusterPatchRecord")
{
$Clustersrequesturi = "http://JFHLABBK01/BeekeeperApi/OPAS.svc/Clusters?`$filter=ClusterId eq " + $Record.ClusterId
$Clusterresults = Invoke-RestMethod -Uri $ClustersrequestUri -UseDefaultCredentials -Headers $URI_Headers
Write-Host " Group currently Executing: " $Clusterresults.value.ClusterName " Node count: " $Record.NodeCount -ForegroundColor Cyan
}
If($Record.'odata.type' -eq "OPASSvc.NodePatchRecord")
{
$NodeRequestURI = "http://JFHLABBK01/BeekeeperApi/OPAS.svc/ClusterNodes?`$filter=NodeId eq $($Record.NodeId)"
$NodeResults = Invoke-RestMethod -Uri $NodeRequestURI -UseDefaultCredentials -Headers $URI_Headers
Write-Host " On Node: " $NodeResults.value.NodeName -ForegroundColor Green
$EventRequestURI = "http://JFHLABBK01/BeekeeperApi/OPAS.svc/Events?`$filter=(NodePatchRecordId eq $($Record.RecordId))"

Once you execute the script, it will show you Beekeeper’s progress:

Another example demonstrates more detail and actual status of individual patches.

Within the detail of a device’s patches, Evaluationstate is the progress phase and Compliancestate is the installed state.

This script is in our Github repository:

https://github.com/green-house-data/BeekeeperScripts/blob/master/BK_CheckExecutionJobs.ps1

Recent Blog Posts

lunavi logo alternate white and yellow
3.27.2024
03
.
27
.
2024
Utilizing Bicep Parameter Files with ALZ-Bicep

Ready to achieve more efficient Azure Deployments? You can use Bicep parameters instead of JSON which opens new opportunities for deployment. Let Lunavi expert, Joe Thompson, show you how.

Learn more
lunavi logo alternate white and yellow
3.26.2024
03
.
04
.
2024
Anticipating Surges in Cyber Attacks and Bolstering Your InfoSec Defenses in 2024

Learn how to navigate 2024 with the right InfoSec defenses to protect your organization against a rising number of cyber attacks.

Learn more
lunavi logo alternate white and yellow
3.26.2024
01
.
03
.
2024
Microsoft Copilot is Re-Shaping the Innovation Frontier

Microsoft 365 Copilot has been released, and it's changing the way we work. More than OpenAI or ChatGPT, read how Copilot can seamlessly integrate with your workflow.

Learn more