TROUBLESHOOTING: Perform BES Gather Reset on Relays
Log In or Register to download the BES file, and more.

0 Votes

Versioning - This is the latest version.

1TROUBLESHOOTING: Perform BES Gather Reset on Relays6/29/2021 9:49:24 AM
2TROUBLESHOOTING: Perform BES Gather Reset on Relays6/29/2021 9:52:34 AM

Description

Resets gather states on Relays, by removing those sites' lines from gatherstate.xml and bfemapfile.xml and deleting the content of bfmirror/bfsites folder.

This is a modification to the instructions at https://support.hcltechsw.com/csm?id=kb_article&sysparm_article=KB0079078

 Note: If a client continues requesting a site that is failing, the Relay will again try to retrieve the site and it will again fail to gather.  This may occur for example in cases where clients are still subscribed to defunct operator accounts.

 


Property Details

ID26858
StatusBeta - Preliminary testing ready for more
TitleTROUBLESHOOTING: Perform BES Gather Reset on Relays
DomainBESC
CategoryBES Management
SourceHCL BigFix Professional Services / J. Walker
Source Release Date4/7/2020 12:00:00 AM
KeywordsRelay, Gather, Reset
Is TaskTrue
Added by on 6/29/2021 9:52:34 AM
Last Modified by on 6/29/2021 9:52:34 AM
Counters 336 Views / 15 Downloads
User Rating 1 star 2 star 3 star 4 star 5 star * Average over 0 ratings. ** Log In or Register to add your rating.

Relevance

Used in 15 fixlets and 3 analyses   * Results in a true/false
Show indented relevance
exists relay service
Used in 23 fixlets and 3 analyses   * Results in a true/false
Show indented relevance
if exists property "in proxy agent context" then not in proxy agent context else true

Actions

Action 1 (default)

Action Link Click here to deploy this action.
Script Type BigFix Action Script
parameter "timestamp"="{(year of item 0 of it as string & month of item 0 of it as two digits & day_of_month of item 0 of it as two digits & two digit hour of item 1 of it & two digit minute of item 1 of it & two digit second of item 1 of it) of (date (local time zone) of it, time (local time zone) of it) of now}"
parameter "gatherstate"="{pathname of file "gatherstate.xml" of folders "Mirror Server\Inbox" of parent folders of folders (value of setting "_BESRelay_HTTPServer_ServerRootPath" of client as string)}"
parameter "bfemapfile"="{pathname of file "bfemapfile.xml" of folders "Mirror Server\Inbox" of parent folders of folders (value of setting "_BESRelay_HTTPServer_ServerRootPath" of client as string)}"
parameter "bfsites"="{pathname of folder "bfmirror/bfsites" of folders (value of setting "_BESRelay_HTTPServer_ServerRootPath" of client as string)}"

action uses wow64 redirection false

// Stop the BESRelay service, forcibly if necessary
// Relay Restart is necessary to make the new values take effect

if {name of operating system starts with "Win"}
waithidden net.exe stop besrelay
elseif {name of operating system starts with "AIX"}
wait /etc/rc.d/rc2.d/KBESRelayd stop
else
    wait /etc/init.d/besrelay stop
endif

// Wait 10 seconds after stopping
parameter "waitTime" = "{apparent registration server time}"
pause while {((apparent registration server time) - time (parameter "waitTime")) < 10 * second}

// If it's still "stopping", give it 2 minutes to finish "stopping"
if {not exists service "BESRelay" whose (state of it = "Stopped")}
parameter "waitTime2" = "{apparent registration server time}"
pause while {((apparent registration server time) - time (parameter "waitTime2")) < 120 * second}
endif

// If it's still "Stopping", kill it
if {not exists service "BESRelay" whose (state of it = "Stopped")}
if {name of operating system starts with "Win"}
     runhidden taskkill.exe /IM BESRelay.exe /F
    else
     run kill -9 {pid of process whose (name of it as lowercase = "besrelay")}
    endif

// Give it 10 seconds to die
parameter "waitTime3" = "{apparent registration server time}"
pause while {((apparent registration server time) - time (parameter "waitTime3")) < 10 * second}
endif


// now that the relay is stopped, we'd like the client to choose another. In case of a locked file or other failure below, we want the client to be reachable so we
// can send any further actions needed to recover.
// When the relay service starts up again, it will trigger the client to re-select to itself.

relay select

// Now we are (finally) ready to reset the Gather State of this relay.

// Attempt to move the folder first, since "move" is more likely than "delete" to succeed (in terms of locked files) and this folder is the most likely one to fail (in terms of locked folder)
move "{parameter "bfsites"}" "{parameter "bfsites"}.{parameter "timestamp"}"

// create a new bfsites folder
folder create "{parameter "bfsites"}"

// move original state tracking files. The Relay service will create new ones.
delete "{parameter "bfemapfile"}.{parameter "timestamp"}"
move "{parameter "bfemapfile"}" "{parameter "bfemapfile"}.{parameter "timestamp"}"

delete "{parameter "gatherstate"}.{parameter "timestamp"}"
move "{parameter "gatherstate"}" "{parameter "gatherstate"}.{parameter "timestamp"}"



// start the relay service again
if {name of operating system starts with "Win"}
    waithidden net.exe start besrelay
elseif {name of operating system starts with "AIX"}
    wait /etc/rc.d/rc2.d/SBESRelayd start_skipclientrestart
else
    wait /etc/init.d/besrelay start_skipclientrestart
endif

// Give Relay 20 seconds to start
parameter "waitTime4" = "{apparent registration server time}"
pause while {((apparent registration server time) - time (parameter "waitTime4")) < 20 * second}
relay select

// if for some reason the BES Relay hasn't started yet, fail here
continue if {exists running service "BESRelay"}

// Now that the relay is back up (and presumably working under a new bfsites folder), delete the original bfsites folder
folder delete "{parameter "bfsites"}.{parameter "timestamp"}"

// restart the client to "preload" some new sites on the relay. When the client requests sites, the Relay will cache them.
client restart
Success Criteria

This action will be considered successful when the applicability relevance evaluates to false.


Sharing

Social Media:
Share this page on Yammer

Comments

Log In or Register to leave comments!