This proved to be problematic today because we need to monitor 3 separate Java (surprise, surprise) processes. However, their command line strings are so long that, after the 80 character truncation, the strings are identical. This means that there's no way to tell the difference between them from a monitoring point of view (using the pid is too unreliable btw, since we have no idea when they might restart). I checked the latest version of Proc::ProcessTable to see if Dan Urist had already dealt with this but, alas, no.
There are a couple of workarounds. First, we could parse "/usr/ucb/ps -auxww", which is different than your standard 'ps' command. The 'ww' widens the command line string as wide as it will go. The second option, and the one I favor, is to modify my C source. After some extensive searching, I found a handy snippet of C code that does what I need (in addition to providing ENV info, which is nice).
There are some caveats to this. It's possible for a program to create false information its own command line options or environment information. Generally this is done as a security precaution to prevent you from picking up something critical (like a password). Most programs (at least not the ones I'm dealing with) aren't that security conscious, however, so it shouldn't be an issue.
In other news, I discovered that gooogle.com takes you to google.com. I suffered a brief moment of panic at work when I realized what I had done, thinking it might take me to a porn site. *Whew*.
where/how, please ? (Score:1)
Need to do the same thing.. parse the psinfo structure. An additional complication is that it also needs to run, almost out of the box, in a Linux machine (and I find that the /proc filesystems are not POSIX compliant)
My solution, for now, is to actually install Proc::ProcessTable on the server, do a shell call from inside C to a script, parse the output from the script and then pack and send onto the client (this is for server process information). sysinfo (native C call) had possibilities, but didnt give
Re:where/how, please ? (Score:2)
The other link, which I haven't looked at in depth yet but which looked promising, can be found here [sun.com]. It's from a Sun support forum and I think they took a different approach.
Enjoy!
Re:where/how, please ? (Score:2)