A java game-server I’m deploying got attacked over the weekend by a script-kiddie (you can tell because the logfiles show attempts to cause buffer-overflows AND INVOKE CMD.EXE! On a server that is openly unix-based (if they’d bothered to look ;)) and runs a Java server). Anyway, once I’d finished laughing at them…
The server didn’t crash, and still accepts incoming connections, but for some reason one of the Selector’s that processes requests has just stopped functioning entirely. It could be that the garbage the skiddie was throwing at it (all sorts of rubbish characters) has upset the 1.4.1 Selector; I have no idea. However, I now want to add some JVM-monitoring tools to the server (it already has an interactive admin console) to do things like check “Are all the Selector’s OK? Are any of the incoming-queue’s unnaturally full (suggesting “hung” connections etc)? What’s the memory usage like at the moment?”.
Some of these (especially the simple stuff, like current free memory) must have been very useful to many developers for many years, but I cannot seem to find ANY java tools on the net that can be integrated into a compiled app (e.g. as a library) that can spew useful status-info. The nearest I could come up with is profilers and debuggers - neither of which is appropriate, because this is a production server where I do NOT need this stuff running 24/7, I just need to do an occasional “give me a snapshot of the status now, please” - even if that means server slowdown for seconds/minutes/etc.
Some of it is trivial to implement (e.g. getting at memory info from the Runtime class), but other things (like the status of a given Selector) are not so trivial. If I have to, I’ll implement my own framework whereby every module supplies String[]'s of it’s own status on demand - but surely this is reinventing the wheel?