BIGDELETE v2.1
Log In or Register to download the BES file, and more.

1 Votes

Description

Action Parameters:

  <<  Enter the Bigfix Server Operator Name
    <<  Enter the Bigfix Server Operator Password 

_____________________________________________________________________________________________________

BIGDELETE v2.1

Bigdelete will delete STOPPED & EXPIRED actions based on their age.

By default, archiving is turned on. All deleted actions will be stored at "c:\export\action_archive"
To turn this feature off, comment out lines 28 - 31.

By default, this action will run once every day.

Prerequisites:
The endpoint that will be the target of this action should be available 24/7.  It will also need Curl installed. NOTE: As of Windows 10 build 1803, Curl is already installed and located in the System32 directory.


Property Details

ID26854
StatusProduction - Fully Tested and Ready for Production
TitleBIGDELETE v2.1
DomainBES
CategoryBigfix Maintenance
Sourcemichael.english@hcl.com
Source Release Date7/9/2020 12:00:00 AM
KeywordsBigDelete, Automate, Action Delete, REST API, Console
Is TaskTrue
Added by on 5/6/2021 11:21:36 AM
Last Modified by on 5/6/2021 11:21:36 AM
Counters 440 Views / 14 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 74 fixlets and 6 analyses   * Results in a true/false
Show indented relevance
version of client >= "9.0"
Used in 7 fixlets   * Results in a true/false
Show indented relevance
(name of operating system starts with "Win")

Actions

Action 1 (default)

Action Link Click here to deploy this action.
Script Type BigFix Action Script
//Pathname to curl
action parameter query "cURL" with description "Please enter the full path to curl binary" with default value "%22C:\Windows\System32\curl.exe%22"

//Action Age :
action parameter query "nDays" with description "Please enter the age in days of the action(s) to be deleted" with default value "30"

//IP or Hostname and PORT of Bigfix Server:
action parameter query "BFServer" with description "Please enter the IP address or Hostname and Port of the Bigfix REST API (must be resolvable):" with default value "11.11.11.11:52311"

//Check for C:\export
if {not exist folder "c:\export"}
    dos mkdir "c:\export"
endif

delete "c:\export\expiredActionIDs.txt"
delete "c:\export\expiredActions.xml"
delete __appendfile

//Get expired action IDs
wait {parameter "cURL" of action} -k -u {parameter "RemoteOP" of action}:{parameter "RemoteOPPass" of action} -X POST -d "relevance=(IDs%20of%20BES%20Actions%20whose%20%28%28state%20of%20it%20as%20lowercase%20%3D%20%22expired%22%20OR%20state%20of%20it%20as%20lowercase%20%3D%20%22stopped%22%29%20AND%20%28%28%28time%20stopped%20of%20it%20%3C%3D%20%28now%20-{parameter "nDays" of action}%2Aday%29%29%20%7C%20false%29%20OR%20%28%28time%20issued%20of%20it%20-%20now%20%3C%3D%20-{parameter "nDays" of action}%2Aday%29%20%7C%20false%29%29%29)" https://{parameter "BFServer" of action}/api/query -o "c:\export\expiredactions.xml"

//Strip XML
delete __appendfile
appendfile {concatenation "%0d%0a" of (preceding texts of firsts "" of (following texts of firsts "type=%22integer%22>" of (lines whose (it contains "") of file "c:\export\expiredactions.xml")))}
move __appendfile "c:\export\expiredActionIDs.txt"

//Archive Actions
if {not exist folder "c:\export\action_archive"}
    dos mkdir "c:\export\action_archive"
endif
wait cmd.exe /C for /f %i in (C:\export\expiredActionIDs.txt) do ( {parameter "cURL" of action} -k -u {parameter "RemoteOP" of action}:{parameter "RemoteOPPass" of action} -X GET https://{parameter "BFServer" of action}/api/action/%i -o c:\export\action_archive\%i.bes )

//Delete Actions
wait cmd.exe /C for /f %i in (C:\export\expiredActionIDs.txt) do ( {parameter "cURL" of action} -k -u {parameter "RemoteOP" of action}:{parameter "RemoteOPPass" of action} -X DELETE https://{parameter "BFServer" of action}/api/action/%i )
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!