Thought no one here was able to find an answer, I was able to develop these routines from some hints I found on a Python news group. Here is some sample code that gets the data I was referring to. I hope this will help those in the future that have this same problem. Don * Disk Error Routines * print out a couple of interesting things */ #include <kstat.h> #include <stdio.h> #include <inttypes.h> #define SLEEPTIME 10 void my_named_display(char *, char *, kstat_named_t *); void disp_disk_err(kstat_ctl_t *,kstat_t *); main(int argc, char **argv) { kstat_ctl_t *kc; kstat_t *ksp; kc = kstat_open(); for (ksp = kc->kc_chain; ksp != NULL; ksp = ksp->ks_next) { if (ksp->ks_type == KSTAT_TYPE_NAMED) { if (!strncmp(ksp->ks_module,"sderr",5)) disp_disk_err(kc, ksp); } } } void disp_disk_err(kstat_ctl_t *kc,kstat_t *ksp) { kstat_named_t *knp; kstat_read(kc, ksp, NULL); printf("The data is for: %s\n ", ksp->ks_name); knp = kstat_data_lookup(ksp, "Vendor"); printf("The Vendor is: "); my_named_display(ksp->ks_name, ksp->ks_class, knp); printf("\n"); knp = kstat_data_lookup(ksp, "Product"); printf("The Product is: "); my_named_display(ksp->ks_name, ksp->ks_class, knp); printf("\n"); knp = kstat_data_lookup(ksp, "Revision"); printf("The Revision is: "); my_named_display(ksp->ks_name, ksp->ks_class, knp); printf("\n"); knp = kstat_data_lookup(ksp, "Serial No"); printf("The Device Serial Number is:"); my_named_display(ksp->ks_name, ksp->ks_class, knp); printf("\n"); knp = kstat_data_lookup(ksp, "Device Not Ready"); printf("The Device Not Ready count is: "); my_named_display(ksp->ks_name, ksp->ks_class, knp); printf("\n"); knp = kstat_data_lookup(ksp, "Hard Errors"); printf("The Hard Error Count is: "); my_named_display(ksp->ks_name, ksp->ks_class, knp); printf("\n"); knp = kstat_data_lookup(ksp, "Illegal Request"); printf("The Illegal Request count is: "); my_named_display(ksp->ks_name, ksp->ks_class, knp); printf("\n"); knp = kstat_data_lookup(ksp, "Media Error"); printf("The Media Error count is: "); my_named_display(ksp->ks_name, ksp->ks_class, knp); printf("\n"); knp = kstat_data_lookup(ksp, "No Device"); printf("The No Device count is: "); my_named_display(ksp->ks_name, ksp->ks_class, knp); printf("\n"); knp = kstat_data_lookup(ksp, "Transport Errors"); printf("The Transport Error count is: "); my_named_display(ksp->ks_name, ksp->ks_class, knp); printf("\n"); knp = kstat_data_lookup(ksp, "Predictive Failure Analysis"); printf("The Predictive Failure Analysis is: "); my_named_display(ksp->ks_name, ksp->ks_class, knp); printf("\n"); knp = kstat_data_lookup(ksp, "Recoverable"); printf("The Recoverable Error count is: "); my_named_display(ksp->ks_name, ksp->ks_class, knp); printf("\n"); /* dump some info about all I/O kstats every SLEEPTIME seconds */ } void my_named_display(char *devname, char *class, kstat_named_t *knp) { switch(knp->data_type) { case KSTAT_DATA_CHAR: printf("%.16s",knp->value.c); break; case KSTAT_DATA_INT32: printf("%" PRId32,knp->value.i32); break; case KSTAT_DATA_UINT32: printf("%" PRIu32,knp->value.ui32); break; case KSTAT_DATA_INT64: printf("%" PRId64,knp->value.i64); break; case KSTAT_DATA_UINT64: printf("%" PRIu64,knp->value.ui64); } } Don Weeks Sr Systems Administrator Spatial Wireless, Inc _______________________________________________ sunmanagers mailing list sunmanagers@sunmanagers.org http://www.sunmanagers.org/mailman/listinfo/sunmanagersReceived on Tue Oct 21 12:10:44 2003
This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:43:20 EST