Tuesday, July 13, 2010

Sample client for istatd

IPhone owners can use a great app for servers monitoring - istat. On the server you must install the istatd daemon. More information can be read here: http://blogs.sun.com/karim/entry/monitoring_opensolaris_from_an_itouch.
Here an example of a console client for istatd, you can use this data for plotting, etc:
$ gcc -o istatd_client istatd_client.c -lsocket -lnsl
$ ./istatd_client
Usage: istatd_client <server_ip> <server_port> <server_code>
Example output from OpenSolaris server:

/istatd_client XX.XXX.XX.X 5109 12345
Connected to XX.XXX.XX.X on port 5109

<?xml version="1.0" encoding="UTF-8"?><isr ready="1"></isr>
<?xml version="1.0" encoding="UTF-8"?><isr pl="2" ath="0" ss="6" c="7788968" n="7788967"></isr>
<?xml version="1.0" encoding="UTF-8"?><isr ds="8" ts="8" fs="8" rid="1"><CPU><c id="-1" u="1" s="3" n="0"></c></CPU><NET if="1"><n id="-1" d="12545352948" u="276928235931" t="1279010768"></n></NET><MEM w="1568" a="326" i="0" f="190" t="2086" su="51" st="1043" pi="79363" po="17312"></MEM><LOAD one="0.230469" fv="0.238281" ff="0.234375"></LOAD><UPT u="7788967"></UPT><DISKS><d n="/" uuid="rpool/ROOT/opensolaris-1" f="43352" p="21.1999"></d><d n="/hosting" uuid="hosting" f="134024" p="4.63293"></d></DISKS></isr>

Looking through istatd code, you can easily recognize what's mean all these variables (for example "u" in <CPU> denotes cpu_user usage).

Unleashed - an operating system fork of illumos

If someone looking for the operating system with ZFS, DTrace and other illumos-buns, system that has been a bit cleared from the some ...