The OpenBSD operating system has many ways to get system info. One way is to use the sysstat utility. This returns comprehensive information about a running UNIX system.
Run sysstat with no parameters and you will get output like this.
2 users Load 0.51 0.36 0.16 neo.home 10:32:19 memory totals (in KB) PAGING SWAPPING Interrupts real virtual free in out in out 101 total Active 70972 70972 3347280 ops 100 clock All 702836 702836 7588404 pages 1 mpi0 uhci0 Proc:r d s w Csw Trp Sys Int Sof Flt forks em0 63 30 35 1 100 6 fkppw pckbc0 fksvm pckbc0 0.0%Int 0.0%Spn 0.0%Sys 0.0%Usr 100.0%Idle pwait | | | | | | | | | | | relck rlkok noram Namei Sys-cache Proc-cache No-cache ndcpy Calls hits % hits % miss % fltcp zfod cow Disks cd0 sd0 33750 fmin seeks 45000 ftarg xfers 1 itarg speed 2K 1 wired sec 0.0 pdfre pdscn pzidl IPKTS 13 kmape OPKTS |
The vmstat utility returns information about kernel statistics, this can provide details of virtual memory.
neo$ vmstat procs memory page disks traps cpu r s avm fre flt re pi po fr sr cd0 sd0 int sys cs us sy id 1 62 66M 3271M 198 0 0 0 0 0 0 15 19 358 74 0 1 9 |
To return details of disk activity, and CPU usage, use the iostat command, this can also be used on Linux.
neo$ iostat tty cd0 sd0 cpu tin tout KB/t t/s MB/s KB/t t/s MB/s us ni sy sp in id 0 30 0.00 0 0.00 19.14 16 0.31 0 0 1 0 0 99 |
Show alternate disk statistics using this flag.
neo$ iostat -D cd0 sd0 KB xfr time KB xfr time 0 0 0.00 277 15 0.02 |
For the retrieval of hardware information on OpenBSD, use the sysctl command.
neo$ sysctl grep hw sysctl: top level name grep in grep is invalid hw.machine=amd64 hw.model=Intel(R) Core(TM) i5-4670K CPU @ 3.40GHz hw.ncpu=1 hw.byteorder=1234 hw.pagesize=4096 hw.disknames=cd0:,sd0:db92a6912ec16d35 hw.diskcount=2 hw.sensors.acpiac0.indicator0=On (power supply) hw.sensors.vmt0.timedelta0=-72.617481 secs, OK, Tue Apr 30 10:50:16.778 hw.cpuspeed=3399 hw.vendor=VMware, Inc. hw.product=VMware Virtual Platform hw.version=None hw.serialno=VMware-56 4d 19 23 1f cd bc d9-b2 ce 91 c3 44 6f 3b 80 hw.uuid=564d1923-1fcd-bcd9-b2ce-91c3446f3b80 hw.physmem=4277993472 hw.usermem=4277981184 hw.ncpufound=1 hw.allowpowerdown=1 hw.smt=0 hw.ncpuonline=1 |
This gives a nice listing of hardware installed in our machine, which in my case is VMware. This also lists the acpi sensors that may be installed and usable.
To list just the disk names, not the rest of the output, use this example as a guide.
neo$ sysctl | grep hw.disknames | cut -d '=' -f 2 cd0:,sd0:db92a6912ec16d35 |
Just use grep as normal, then use cut to set the = sign as the delimiter, and then also select the column of text you wish to echo. Then we can filter for certain hardware information.