# p4survey

A survey tool to gather basic information about a P4 installation.

Download for your platform and execute.

The following should be defined in your environment (easiest) or can be provided as parameters to the tool:

* P4PORT - the p4d server you are talking to
* P4USER - the p4d user account you are using
* P4BIN - the path to the `p4` or `p4.exe` if it is not in your `$PATH` for your shell

Please note you should have logged in to the p4d server already, and have `super` privileges (to be able to execute some commands)

Tool with exit with an error if not being run as a logged in super user!

## Downloads

* [For Linux AMD64](https://swarm.workshop.perforce.com/files/guest/perforce_software/p4survey/bin/p4survey.linux-amd64.gz)
* [For Linux ARM64](https://swarm.workshop.perforce.com/files/guest/perforce_software/p4survey/bin/p4survey.linux-arm64.gz)
* [For Mac/DARWIN ARM64](https://swarm.workshop.perforce.com/files/guest/perforce_software/p4survey/bin/p4survey.darwin-arm64.gz)
* [For Mac/DARWIN AMD64](https://swarm.workshop.perforce.com/files/guest/perforce_software/p4survey/bin/p4survey.darwin-amd64.gz)
* [For Windows AMD64](https://swarm.workshop.perforce.com/files/guest/perforce_software/p4survey/bin/p4survey.windows-amd64.exe.gz)

After downloading, unzip (gunzip) and if necessary make executable.

E.g. for Linux:

```[bash]
wget https://swarm.workshop.perforce.com/files/guest/perforce_software/p4survey/bin/p4survey.linux-amd64.gz
gunzip p4survey.linux-amd64.gz
chmod +x p4survey.linux-amd64

./p4survey.linux-amd64 -h
```

To run:

```[bash]
./p4survey.linux-amd64
Running p4survey analysis as user "jbloggs" on P4PORT "some-server:2001"
Markdown report written: p4survey.XXXX.md
If you have any questions, please contact support-p4@perforce.com
```

Send the resulting file: p4survey.XXXX.md

## Help

```[bash]
usage: p4survey [<flags>]

A survey tool for Perforce P4 servers. Will report on the server configuration.

Must be run as a logged in superuser.


Flags:
  -h, --help           Show context-sensitive help (also try --help-long and --help-man).
      --p4user=P4USER  (Optional) Perforce user (default $P4USER)
      --p4port=P4PORT  (Optional) Perforce server port (default $P4PORT)
      --p4bin=P4BIN    (Optional) Full path of p4 CLI (default is 'p4' in $PATH)
      --debug          Debug output
  -V, --version        Show application version.
```

The output will be a Markdown formatted file which can be zipped and sent to consulting or support.

## Analysis

The following commands are run:

```[bash]
p4 -ztag info
p4 license -u
p4 diskspace
p4 configure show allservers
p4 servers -J
p4 -ztag servers
p4 -ztag depots
p4 triggers -o
p4 extension --list --type extensions
p4 extension --list --type global
p4 extension --list --type instance
p4 extension --list --type certs
p4 property -n P4.Swarm.URL -l
p4 keys -e "swarm-*" -m 1
p4 keys -e "git-*" -m 1
p4 typemap -o
p4 jobspec -o
p4 counter change
p4 dbstat -s
p4 journals -m 3
p4 protects -u remote
```
