prtdiag - new (for me) solaris command

djberg96 on 2003-02-03T15:52:31

In my quest to get cpu info on solaris, I came across the command "prtdiag". Most solaris boxes have it (I think), though it's probably not in your path. Check /usr/platform/<system>/sbin, where <system> is the current system type (probably "sun4u" these days, but double check).

Anyway, it provides a lot more information than ye ol' sys/processor.h file does, including cpu temperature and exact type, plus some other goodies. I'm now searching for the source for prtdiag to see if I can wrap it. :)


prtdiag is so 90s :)

hfb on 2003-02-03T17:04:49

If you have solaris 9, try kstat. Solaris 8 has kstat too but you'll need to get the kstat module off of CPAN.

Re:prtdiag is so 90s :)

djberg96 on 2003-02-03T18:41:49

Is prtdiag just another subset of kstat? I wasn't sure. I didn't see anything for getting the cpu temp, for example, although the man page doesn't strike me as complete.

I downloaded Solaris::Kstat but it's only good for 2.5, 2.6 and 2.7 (so it says). At least that tells me I need to watch out for using kstat functions that aren't in older versions of solaris. I'm sure I'll be able to get some ideas from it, although the documentation is a bit lacking IMHO.

Hopefully, Sun will provide smaller libs in the future for us mediocre C programmers (such as sys/loadavg.h, available since 2.7) so that we don't have to decipher kstat.h. Right now, comp.unix.solaris is a very good friend. :)

Re:prtdiag is so 90s :)

hfb on 2003-02-03T20:32:42

ah, right...kstat, the command utility is in 8 as well. The library is pretty much the same across 2.5->9 but the kstat utility, which is perl I might add, is in 8 and up. I didn't think prtdiag had the environmental output before solaris 8 or with earlier sun4u boxes. envctrl_temp is the kstat instance that you want but I'm not sure if the kstat utility will grab that or not...though, since it's perl, you can probably make it do what you need.