There are various ways you can monitor Perforce Server (Helix Core Server – p4D).
Method 1 – Monitoring the Perforce Server disk space
Use the p4 diskspace command to monitor diskspace usage. By default, p4 diskspace displays the amount of free space, diskspace used, and total capacity of any filesystem used by Helix Server.
[code]# Shows summary information about the current availability of disk space on the server
$ p4 diskspace
# Report disk space available for filesystem holding the specified depot.
$ p4 diskspace depot
# Report disk space available for filesystem holding P4JOURNAL.
$ p4 diskspace P4JOURNAL
# Report disk space available for filesystem holding P4LOG (server log).
$ p4 diskspace P4LOG
# Report disk space available for filesystem holding P4ROOT.
$ p4 diskspace P4ROOT
# To Set the Storage and reserve ten percent of the total disk space for P4ROOT:
$ p4 configure set filesys.P4ROOT.min=10%
# To estimate how much disk space is currently occupied by specific files in a depot, use the p4 sizes command
# p4 sizes -a -s -b 512 //depot/…[/code]
Method 2 – Monitoring the Perforce Server process
Use the p4 monitor command to observe and control Helix Server-related processes running on your Helix Server machine
[code]# To monitor active commands, set the monitor configurable to 1:
$ p4 configure set monitor=1
#Valid values for the monitor configurable are:
0: Server process monitoring off. (Default)
1: monitor active commands
2: active commands and idle connections
3: sames as 2, but also includes connections that failed to initialize (stuck at the Init() phase)
5: sames as 2, but also includes a list of the files locked by the command for more than one second
10: same as 5, but also includes lock wait times
25: sames as 10, except that the list of files locked by the command includes files locked for any duration
# To monitor the Zoombie Process
$ p4 monitor terminate pid
where pid is a process identifier.
# How to Enabling idle processes monitoring
$ p4 configure set monitor=2
$ p4 monitor show -s I
# To list the processes monitored by Helix Server, use the command:
$ p4 monitor show
$ p4 monitor show -s R
$ p4 monitor show -a
$ p4 monitor show -e
$ p4 monitor show -a -l
# Showing information about locked files
$ p4 monitor show -L[/code]
Method 3 – Setting Perforce Server (Helix Core Server) trace and tracking flags
# To modify the behavior of command tracing or performance tracking, specify the appropriate -v subsystem=value flag to the p4d startup command. Use P4LOG or the -L logfile flag to specify the log file. For example:
$ p4d -r /usr/perforce -v server=2 -p 1666 -L /usr/perforce/logfile
# Alternatively, you can use the p4 configure command:
$ p4 configure set server=3[/code]
Method 4 – Auditing user file access
Auditing is disabled by default, and is only enabled if P4AUDIT is set to point to the location of the audit log file, or if the server is started with the -A auditlog flag.
[code]$ tail -2 auditlog
If a command is run on the machine that runs the Helix Server, the clientIP is shown as 127.0.0.1.[/code]
Method 5 – P4Nagios: Helix Monitoring for the Enterprise
If your organization has to manage multiple servers, then you probably already know about or are using an infrastructure monitoring suite such as Nagios.
P4Nagios can alert on:
• inaccessible P4D service.
• imminent P4D license expiry.
• excessive concurrent P4 commands.
• replication status (when monitoring the replica).
• lack of available P4D disk space.