Files
statscollect/readme.org
2025-08-28 21:38:04 -04:00

265 lines
5.1 KiB
Org Mode

* about
This program has been tested on TrueNAS CORE and SCALE
Will automatically upload to our FTP server.
If they are airgapped, they can take a debug to get stats.
* clone repo
#+begin_src shell
git clone https://git.sdgarren.com/scott/statscollect.git
#+end_src
* run program
should run in tmux or screen
#+begin_src shell
cd statscollect
python3 collect.py
#+end_src
* collection on CORE
** Disk
#+begin_src shell
iostat -xyd 1 1
#+end_src
iostat = [
"timestamp",
"name",
"read_s",
"rkB_s",
"rrqm_s",
"%rrqm",
"r_await",
"rareq-sz",
"w_s",
"wkB_s",
"wrqm_s",
"%wrqm",
"w_await",
"wareq-sz",
"d_s",
"dkB_s",
"drqm_s",
"%drqm",
"d_await",
"dareq-sz",
"f_s",
"f_await",
"aqu-sz",
"%util",
]
** CPU
#+begin_src shell
iostat -c 1 1
#+end_src
cpustat = [
"timestamp",
"name",
"%user",
"%nice",
"%system",
"%iowait",
"%steal",
"%idle",
]
** Memory
#+begin_src shell
top -bn 1
#+end_src
memstat = [
"timestamp",
"name",
"mem_used",
"mem_free",
]
** Network
#+begin_src shell
ifstat -znq 1 1
#+end_src
ifstat = [
"timestamp",
"name",
"Kbps_in",
"Kbps_out",
]
** ZFS
#+begin_src shell
zpool iostat -Tu -l -p -v -y 15 1
#+end_src
ziostat = [
"timestamp",
"name",
"capacity_alloc",
"capacity_free",
"ops_read",
"ops_write",
"bandwidth_read",
"bandwidth_write",
"total_wait_read",
"total_wait_write",
"disk_wait_read",
"disk_wait_write",
"syncq_wait_read",
"syncq_wait_write",
"asyncq_wait_read",
"asyncq_wait_write",
"scrub_wait",
"trim_wait",
"rebuld_wait",
]
* collection on SCALE
** Disk
#+begin_src shell
gstat -C -s -d -o -p -I 5s
#+end_src
gstat = [
"timestamp",
"name",
"q-depth",
"total_ops_s",
"read_s",
"read_sz-KiB",
"read-KiB_s",
"ms_read",
"write_s",
"write_sz-KiB",
"write-KiB_s",
"ms_write",
"delete_s",
"delete-sz-KiB",
"delete-KiB_s",
"ms_delete",
"other_s",
"ms_other",
"%busy",
]
** CPU
#+begin_src shell
iostat -C -t proc -d
#+end_src
cpustat = [
"timestamp",
"name",
"%user",
"%nice",
"%system",
"%iowait",
"%steal",
"%idle",
]
** Memory
#+begin_src shell
top -n 1
#+end_src
memstat = [
"timestamp",
"name",
"mem_used",
"mem_free",
]
** Network
#+begin_src shell
ifstat -znq 1 1
#+end_src
ifstat = [
"timestamp",
"name",
"Kbps_in",
"Kbps_out",
]
** ZFS
#+begin_src shell
zpool iostat -Tu -l -p -v -y 15 1
#+end_src
ziostat = [
"timestamp",
"name",
"capacity_alloc",
"capacity_free",
"ops_read",
"ops_write",
"bandwidth_read",
"bandwidth_write",
"total_wait_read",
"total_wait_write",
"disk_wait_read",
"disk_wait_write",
"syncq_wait_read",
"syncq_wait_write",
"asyncq_wait_read",
"asyncq_wait_write",
"scrub_wait",
"trim_wait",
"rebuld_wait",
]
* Example
#+begin_src shell
root@m40g2-124a[~/statscollect]# python3 collect.py
########################################################################
# FreeNAS CORE/SCALE performance capture script v.02 #
########################################################################
# This script collects cpu/mem/disk/network/pool #
# When it is completed, it will copy csv files to your /var/log folder #
# It will then attempt to take a debug and upload both to our FTP #
# If not connected to the internet, it will have to be manually d/l #
########################################################################
# Running this script repeatedly will append results to CSV files #
# - https://gitlab.komputernerds.com/mmance/statscollect - #
########################################################################
Enter the duration in minutes: 5
Enter the delay before capture in minutes: 2
Delaying capture by 2 minutes...
0 1 Starting Collection
Minute: 0 1 2 3 4
Copied 'ifStat.csv' to /var/log successfully.
Copied 'gstat.csv' to /var/log successfully.
Copied 'cpuStat.csv' to /var/log successfully.
Copied 'boot-pool-zio.csv' to /var/log successfully.
Copied 'memStat.csv' to /var/log successfully.
Copied 'tank-zio.csv' to /var/log successfully.
Taking new debug.
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1969k 0 0 100 1969k 0 2055k --:--:-- --:--:-- --:--:-- 2055k
Data collection and upload completed.
root@m40g2-124a[~/statscollect]#
#+end_src
#+begin_src shell
python3 collect.py 5 2
#+end_src