{{tag>PUB Perf}} # Notes sysstat sar Voir : * https://www.linuxjournal.com/content/how-use-sar-system-activity-reporter Voir aussi : * [[notes atop]] * nmon ## Install ~~~bash apt-get update apt-get install sysstat ~~~ `/etc/default/sysstat` ~~~ini ENABLED="true" ~~~ ~~~ # service sysstat restart Starting the system activity data collector: sadc. ~~~ ## Utilisation ~~~ $ dpkg -L sysstat | grep 'bin/' /usr/bin/nfsiostat /usr/bin/pidstat /usr/bin/sadf /usr/bin/iostat /usr/bin/mpstat /usr/bin/sar.sysstat /usr/bin/cifsiostat ~~~ Report CPU utilization ~~~bash sar -u ALL ~~~ Report per-processor CPU utilization ~~~bash sar -P ALL ~~~ Display all CPU utilization per 2 seconds 3 times ~~~bash mpstat -P ALL 2 3 # mpstat -A 1 ~~~ Report memory utilization ~~~bash sar -r ALL ~~~ Report swap space utilization ~~~bash sar -S ~~~ Report hugepages utilization ~~~bash sar -H ~~~ Report paging statistics ~~~bash sar -B ~~~ Report swapping statistics ~~~bash sar -W ~~~ Report I/O and transfer rate statistics ~~~bash sar -b ~~~ Report block device activity ~~~bash sar -d ~~~ Report process creation and system switching activity ~~~bash sar -w ~~~ Report queue length and load averages ~~~bash sar -q ~~~ Display I/O disk with Mega bytes per 2 seconds ~~~bash iostat -mx -d 2 ~~~ Report network utilization ~~~bash sar -n ALL ~~~ Display I/O and network per 2 seconds 5 times ~~~bash sar -b -n DEV 2 5 ~~~ Display data in human readable way ~~~bash sar -r -h ~~~ Display memory utilization of specific process per a second 3 times ~~~bash pidstat -r -p 21090 1 3 ~~~ Charge sur une période donnée ~~~bash sar -q -f /var/log/sa/sa27 -s 16:00:00 -e 17:00:00 sar -A -f /var/log/sa/sa27 -s 16:00:00 -e 17:00:00 ~~~ Un peu de couleurs ~~~bash env S_COLORS=always sar -A | less -R -S env S_COLORS=always sar -n DEV | grep --color=never eth0 ~~~ Voir aussi : * dircolors ### Autres Réseaux ~~~bash sar -n ALL sar -n DEV sar -n TCP sar -n ETCP sar -n IP sar -n EIP ~~~ Disques ~~~bash iostat -p -x ~~~ ## Configuration ### Timer ~~~bash # systemctl edit --full sysstat-collect.timer systemctl cat sysstat-collect.timer ~~~ `/usr/lib/systemd/system/sysstat-collect.timer` ~~~ini # /usr/lib/systemd/system/sysstat-collect.timer # (C) 2014 Tomasz Torcz # # sysstat-11.7.3 systemd unit file: # Activates activity collector every 10 minutes [Unit] Description=Run system activity accounting tool every 10 minutes [Timer] OnCalendar=*:00/10 [Install] WantedBy=sysstat.service ~~~ ~~~bash systemctl edit sysstat-collect.timer ~~~ `/etc/systemd/system/sysstat-collect.timer.d/override.conf` ~~~ini [Unit] Description=Run system activity accounting tool every 5 minutes [Timer] OnCalendar= OnCalendar=*:5/5 ~~~ ## Pb ~~~bash # sar -n TCP Requested activities not available in file /var/log/sa/sa31 ~~~ `/etc/sysconfig/sysstat` ~~~bash # Parameters for the system activity data collector (see sadc(8) manual page) # which are used for the generation of log files. # By default contains the `-S DISK' option responsible for generating disk # statisitcs. Use `-S XALL' to collect all available statistics. SADC_OPTIONS="-S XALL" ~~~ Important note: The activities (including optional ones) saved in an existing data file prevail over those selected with option -S. As a consequence, appending data to an existing data file will result in option -S being ignored.