Activating debugging for remediation packages
If you encounter problems in remediation jobs or undo jobs for rules within Compliance Content component templates, you can activate the debugging of scripts included in the remediation packages that are associated with the compliance rules. This results in debug-level logging to the job log.
By default, debug-level logging of remediation and undo scripts is not activated. Activation and deactivation of debug-level logging by Compliance Content remediation packages can be performed at the following levels:
- Through individual scripts in individual remediation packages.
- For all scripts in all remediation packages at once.
To set debug-level logging in an individual remediation package
- Navigate to the relevant BLPackage (under the Depot folder) and open it.
- In the hierarchy view, select the EXTERNALCMD object for specific rule remediation.
The right pane shows the attributes associated with the selected object. - Click in the Value column of the Cmd attribute (which contains the remediation script) or the UndoCmd attribute (which contains the undo script), and then click the Open External Editor/File Importer icon.
- In the editor, uncomment the set -x line (that is, remove the # number character) to activate debug-level logging.
To deactivate debug-level logging, comment out the set -x line by adding back the # number character at the beginning of the line.
- Click OK in the editor.
- Save the BLPackage.
To set debug-level logging in all remediation packages
In the file server, create an NSH script file containing one of the following scripts:
Script for activating debug-level logging from Compliance Contentif [ $# != 1 ]
then
echo "Usage: $0 <Path to your BL package directory>"
exit 0
fi
BLPACKAGE_DIR=$1
grep -Rl 'set -x' $BLPACKAGE_DIR | while read file
do
echo " Enabling debug for $file"
sed 's/##*set -x/set -x/g' $file 1>$file.bk
mv $file.bk $file
done
echo " Debug Enable Complete "Script for deactivating debug-level logging from Compliance Content
if [ $# != 1 ]
then
echo "Usage: $0 <Path to your BL package directory>"
exit 0
fi
BLPACKAGE_DIR=$1
grep -Rl 'set -x' $BLPACKAGE_DIR | while read file
do
echo "Disabling debug for $file."
sed 's/set -x/#set -x/g' $file 1>$file.bk
mv $file.bk $file
done
echo "Debug disable Complete"- Set the permission of the NSH script file using the chmod 755 <filename> command.
Start a Network Shell (NSH) session, and logon to the file server.
For example,# nsh
# cd // <fileserver_name>Through the NSH prompt, execute the NSH script that you prepared in step 1 by providing the name of the script and the path to the blpackages directory.
For example:./<script_name> /opt/bmc/BladeLogic/NSH/storage/blpackages