Target release17.1.1
Epic

Document status

Forum Discussion/Reviewhttp://community.pbspro.org/t/pp-758-add-pbs-snapshot-tool-to-capture-state-logs-from-pbs/520/22
Document owner
Designer
Developers
QA


Introduction:

This tool is meant to replace the 'pbs_diag' script which is currently the means to capture data from PBS for diagnostics.

"pbs_snapshot" will be written in Python and will make use of PTL libraries to interact with the PBS system that it is capturing. This will mean that any major changes to PBS will need very minor (if any) refactoring of pbs_snapshot as PTL gets updated in tandem with PBS now, so pbs_snapshot will automatically work with the latest version of PBSPro. 

Also, a new set of utilities (PBSSnapUtils) will be added to PTL itself for this tool, which will be directly available for PTL test writers and developers to write PTL tests/debugging tools which may need the ability to take snapshots of PBS.

The first version of the tool will also come with the ability to anonymize/obfuscate PBS data to enable users with sensitive data to obfuscate and share snapshots for bug reporting and debugging.

Shape and Form of a 'snapshot':

A 'snapshot', which will be the output produced by the pbs_snapshot tool, will be a tarball (.tgz file) named as "snapshot_<timestamp>.tgz" containing the following directory structure & files:

Interface Documentation:

The interface for pbs_snapshot will be as follows:

pbs_snapshot -o <path to existing staging directory> [OPTION]

Take snapshot of a PBS system and optionally capture logs for diagnostics

-H <hostname> primary hostname to operate on
Defaults to local host
-l <loglevel> set log level to one of INFO, INFOCLI,
INFOCLI2, DEBUG, DEBUG2, WARNING, ERROR
or FATAL
-h, --help display this usage message
--daemon-logs=<num days> number of daemon logs to collect
--accounting-logs=<num days> number of accounting logs to collect
--additional-hosts=<hostname> collect data from additional hosts
'hostname' is a comma separated list
--map=<file> file to store the map of obfuscated data
--obfuscate obfuscates sensitive data
--with-sudo Uses sudo to capture privileged data
--version print version number and exit



Caveat - Currently pbs_snapshot will need to be run as root because it needs to access protected PBS information (e.g - information inside the PBS_HOME/ _priv directories). So, it could either be run with sudo, or as root user. If it is run with restricted privileges, it won't be able to query all of the data.


Interface: Option -o <path to target directory>

Interface: Option -H <hostname>

Interface: Option -l <loglevel>

Interface: Option --daemon-logs=<num days>

Interface: Option --accounting-logs=<num days>

Interface: Option --additional_hosts=<hostname>

Interface: Option --map=<file>

Interface: Option --obfuscate

Interface: Option --version

Sample Usage: