Here, we outline how to use Sys-snap, a diagnostic tool that logs up to 24 hours of resource usage data.
It is used to track down the causes of resource shortages, whether CPU or Memory-related, even when no one is looking.
The verbose output lists extra detailed information, events, or connections from the user root, along with the systems services and daemon processes, using the --v flag.
Related Articles
Install Sys-snap
Parse Old Sys-snap Data
Gather Data
IMPORTANT: This solution will require root access. If this needs to be obtained, follow the guide on requesting root access.
-
SSH into the server as root
- Run the command
sys-snap.pl --print HH:MM HH:MM --v
to display verbose output
REPLACE: HH:MM with the start and end time to print.
EXAMPLE: In the output below, we can deduce that/home/eve/public_html/domain.com/script.php
was the main cause of the CPU spike, and the focus should be on that particular script.
~# sys-snap.pl --print 00:00 1:00 --v
user: dovecot memory-score: 84.30 memory-score: M: 84.30 proc: \_ dovecot/auth M: 0.00 proc: \_ dovecot/anvil cpu-score: 6.90 C: 6.90 proc: \_ dovecot/auth C: 0.00 proc: \_ dovecot/anvil user: eve memory-score: 345.00 M: 345.00 proc: /usr/bin/php /home/eve/public_html/domain.com/script.php M: 0.00 proc: /usr/bin/ruby /usr/bin/mongrel_rails start -p 12008 -d -e production -P log/mongrel.pid cpu-score: 23847.00 C: 23847.00 proc: /usr/bin/php /home/eve/public_html/domain.com/script.php C: 0.00 proc: /usr/bin/ruby /usr/bin/mongrel_rails start -p 12008 -d -e production -P log/mongrel.pid
Limited Detailed Output
IMPORTANT: This solution will require root access. If this needs to be obtained, follow the guide on requesting root access.
NOTE: The --max-lines flag, will provide the specified number of lines of detailed information under each process, resource, or service that is logged in the sys-snap.pl file. Providing a way to shorten the amount of output you will see for each logged section.
- SSH into the server as root
- Run the command
sys-snap.pl --print HH:MM HH:MM -v --max-lines <number>
REPLACE: <number> with the number of lines to display and HH:MM with the start and end time to print.
EXAMPLE:
~# sys-snap.pl --print 10:00 11:00 --v --max-lines 3
user: userna5
cpu-score: 64.10
C: 22.00 proc: \_/usr/bin/php
/home/userna5/domain.com/wp-cron.php
C: 22.00 proc: \_ php-fpm: pool domain_com
C: 16.00 proc: \_ php-fpm: pool staging_domain_com
memory-score: 33.30
M: 13.10 proc: \_ php-fpm: pool domain_com
M: 12.80 proc: \_ php-fpm: pool staging_domain_com
M: 2.80 proc: \_ dovecot/im
Comments
0 comments
Article is closed for comments.