Usually, there’s an admin (well, lots of them for different clients) I ask when I have basic questions about system configurations, but like all DBAs, sometimes I need to figure it out myself. Enter db2pd -osinfo.
The -osinfo option on db2pd can give you some of the basic information on OS configuration without having to know or google OS level commands to find it. Recently, I was interested in the number of CPUs on several servers, and I used db2pd -osinfo.
Authorization
The authorities needed for db2pd vary by version. With 8.2 and before, you had to be the instance owner. DB2 9.1 allowed those with SYSADM to run db2pd. DB2 9.1 Fixpack 6 and later allow those with SYSMON, SYSMAINT, SYSCTRL, or SYSADM to run db2pd.
OSINFO
db2pd -osinfo gives a bunch of information. This is what it looks like:
$ db2pd -osinfo Operating System Information: OSName: Linux NodeName: 403906-Perf-db1.redacted.com Version: 2 Release: 6 Machine: x86_64 CPU Information: TotalCPU OnlineCPU ConfigCPU Speed(MHz) HMTDegree Cores/Socket 12 12 12 2394 2 6 Physical Memory and Swap (Megabytes): TotalMem FreeMem AvailMem TotalSwap FreeSwap 48289 1041 n/a 2048 2044 Virtual Memory (Megabytes): Total Reserved Available Free 50337 n/a n/a 3083 Message Queue Information: MsgSeg MsgMax MsgMap MsgMni MsgTql MsgMnb MsgSsz n/a 65536 65536 48128 65536 65536 16 Shared Memory Information: ShmMax ShmMin ShmIds ShmSeg 68719476736 1 12032 12032 Semaphore Information: SemMap SemMni SemMns SemMnu SemMsl SemOpm SemUme SemUsz SemVmx SemAem 256000 12032 256000 256000 250 32 n/a 20 32767 32767 CPU Load Information: Short Medium Long 1.160000 1.080000 0.960000 CPU Usage Information (percent): Total Usr Sys Wait Idle 9.666667 n/a n/a n/a 90.333333
If you go through it line by line, there’s some good information here. The CPU information is up front, and includes not just the number of CPUs and cores, but also the MHz, which could be especially useful to know in a virtual environment. The Physical Memory (it is 48 GB in my example) is good to be able to get this way, along with the other lines of memory details. There’s a line for CPU Load, and finally, usage information – which I’m quite used to getting through vmstat, but is also here. Think how many commands I would have had to run at the OS level to get that information at the OS level. This also lets someone like me, who uses a windows server about once every 3 years, have a standard way to get at the most basic OS information that I might need to know.
Excellent information on DB2PD, I was searching for CPU info from long time, and this post gave me very good picture about the same, Thanks Ember.