This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

How to deal with patch cycles

I've combed through a number of posts relating to this issue, but haven't found exactly what I'm trying to do yet, but feel free to point me in the right direction.

Currently I have built groups with dynamic queries based on 'Node - comments = "Patch cycle x", now those nodes are populating, and I'm able to mute the alerts for the group, however it is not affecting the application monitors on those nodes. I see I'm able to add to those groups using another dynamic query using 'Application - Node and a few options' but no 'Comments' is there a good way to group all nodes and application monitors that are attached to those nodes and mute alerts all at once?

  • If you set your application alerts to specifically need a Down status rather than Not-Up they should usually be ignored correctly by some combination of the down->unmanaged status or mutes. If not there might be something in that alert design that's not playing well, or something coming from how your environment comes back online. Dunno, usually I dont get much of a problem there.

    I built some powershell to mass-schedule mute windows based on "nth Tuesday of the month"-type patching windows and that works OK, but there's a few servers/applications with rogue timeframes i've yet to figure out how to deal with. The last chunk of the below covers connecting to solarwinds and muting stuff once you know what you want to mute and when

    # Find Tuesdays and Thursdays

    $i = 0

    Do

    {

        $FirstOfMonth = (Get-Date -Day 1).Date.AddDays($i)

        $Day = $FirstOfMonth.DayOfWeek

        $DayInt = [int]$Day

        $i++

    }

    Until($Day -eq "Tuesday")

    $1stTuesday = (Get-Date -day $DayInt)

    $2ndTuesday = (Get-Date -day $DayInt).Date.AddDays(7).AddHours(1)

    $3rdTuesday = (Get-Date -day $DayInt).Date.AddDays(14).AddHours(1)

    $4thTuesday = (Get-Date -day $DayInt).Date.AddDays(21).AddHours(1)

    $i = 0

    Do

    {

        $FirstOfMonth = (Get-Date -Day 1).Date.AddDays($i)

        $Day = $FirstOfMonth.DayOfWeek

        $DayInt = [int]$Day

        $i++

    }

    Until($Day -eq "Thursday")

    $1stThursday = (Get-Date -day $DayInt)

    $2ndThursday = (Get-Date -day $DayInt).Date.AddDays(7).AddHours(1)

    $3rdThursday = (Get-Date -day $DayInt).Date.AddDays(14).AddHours(1)

    $4thThursday = (Get-Date -day $DayInt).Date.AddDays(21).AddHours(1)

    #Edit spreadsheet with datetime values - 1AM

    $targets = import-csv -Path 'C:\temp\Patch cycle.csv' | ForEach-Object {

        If ($_.Patchcycle -eq '1st Tuesday') {

            $_.Patchcycle = $1stTuesday

            }

        If ($_.Patchcycle -eq '2nd Tuesday') {

            $_.Patchcycle = $2ndTuesday

            }

        If ($_.Patchcycle -eq '3rd Tuesday') {

            $_.Patchcycle = $3rdTuesday

            }

        If ($_.Patchcycle -eq '4th Tuesday') {

            $_.Patchcycle = $4thTuesday

            }

        If ($_.Patchcycle -eq '1st Thursday') {

            $_.Patchcycle = $1stThursday

            }

        If ($_.Patchcycle -eq '2nd Thursday') {

            $_.Patchcycle = $2ndThursday

            }

        If ($_.Patchcycle -eq '3rd Thursday') {

            $_.Patchcycle = $3rdThursday

            }

        If ($_.Patchcycle -eq '4th Thursday') {

            $_.Patchcycle = $4thThursday

            }

            $_

    }

    #Connect to Solarwinds

    Import-Module swispowershell

    $credential = Import-CliXml -Path "C:\temp\Cred.xml"

    $swis= connect-swis -hostname 'thdatslwapp01' -Credential $credential

    #Loop through spreadsheet, clear values, check SLW for servernames by caption, update customproperties with datetimevalues

    foreach ($line in $targets){

    $URI = $null

    $URI = Get-SwisData $swis "Select Uri FROM Orion.Nodes Where Caption like '$($line.caption)'"

    $URI = $URI+'/customproperties/'

    $hashtable = @{ }

    $hashtable.Add("Maintenance_window_start", "$($line.Patchcycle)")

    $hashtable.Add("Maintenance_window_end", "$($line.Patchcycle.AddHours(3))")

    Set-SwisObject $swis -uri $URI -properties $hashtable

    }

  • I wouldn't be using the comments property for this since it would be better to just create a new property specifically for patch cycles instead of using a generic one.

    I typically just do matching custom properties on the node and app, then I use an alert with logic that says something to the effect of

    node patch_cycle = "x"

    and (

         Application Patch_cycle is blank

         OR

         Application Patch_cycle not equal to "x"

    )

    Then my action is just to set application Patch_Cycle to = the Node Patch_cycle

    This way any time i create a new app it automatically inherits the patch cycle of whatever the parent node has, and if i change the parent node it will sync up all the app children.

    Then you just do two dynamic queries on your group, one for nodes where patch_cycle = "x" and another where applications where patch_cycle = "x"

  • This got me to where I needed to be, both answers were helpful. I just was unaware I could create custom attributes. Thanks!