Photon-based network status tool?

Is there a photon tool which provides the information similar to that
available from the nicinfo/netstat utilities?

I’m looking for something that updates dynamically.

Alternatively, how do nicinfo and netstat get the data from the
system, and can I grab that data and display it from my own
photon app?

Thanks,

Jeff Maass jmaass@columbus.rr.com Located near Columbus Ohio
USPSA # L-1192 NROI/CRO Amateur Radio K8ND
Maass’ IPSC Resources Page: http://home.columbus.rr.com/jmaass

After a bit of research, I see that ‘nicinfo’ uses devctl() on
/dev/io-net/en0 (etc.) to get the information displayed.

I need to do the same. What structure will I get back when I
apply devctl() against class _DCMD_NET? The documentation
seems unclear how to make sense of the data.

Specifically, I would like to be able to extract (as is done in nicinfo):

Ethernet Controller type
Physical Node ID
Media Rate
Total Packets Tx OK
Total Packets Tx Bad
Total Packets Rx OK
Total Packets Rx Bad

Total Bytes Txd
Total Bytes Rxd

…and perhaps some of the other error breakdowns presented
in incinfo.

Thanks,

Jeff Maass jmaass@columbus.rr.com Located near Columbus Ohio
USPSA # L-1192 NROI/CRO Amateur Radio K8ND
Maass’ IPSC Resources Page: http://home.columbus.rr.com/jmaass


“Jeff Maass” <jmaass@columbus.rr.com> wrote in message
news:afod33$o9h$1@inn.qnx.com

Is there a photon tool which provides the information similar to that
available from the nicinfo/netstat utilities?

I’m looking for something that updates dynamically.

Alternatively, how do nicinfo and netstat get the data from the
system, and can I grab that data and display it from my own
photon app?

Thanks,

Jeff Maass > jmaass@columbus.rr.com > Located near Columbus Ohio
USPSA # L-1192 NROI/CRO Amateur Radio K8ND
Maass’ IPSC Resources Page: > http://home.columbus.rr.com/jmaass

I’m not sure if this is useful but I have written a set of routines to
interface the nicinfo structure to our proprietary monitoring interface. I
have pasted in the relevant code (it’s not all-inclusive):

static Nic_t nic; // declared static here to speed up routine

if ((fd = open(devctrlpathname, O_RDONLY)) < 0) {
// cannot open on path
return (ENOSYS);
}

if (devctl(fd,dcmd,&nic,sizeof(nic),dev_info_ptr) < 0) {
return -1;
}
// now pull out required data from nic
return nicinfo_decode(&nic, attr->funcindex, value);

// This all-inclusive nicinfo routine will take a nicinfo structure and,
given the index of
// interest, return a string of the correct format for the stat in question

int nicinfo_decode(Nic_t nic, int nicindex, char value) {

switch(nicindex) {
case NIC_CONV_FLAGS:
return -1;
break;
case NIC_CONV_FILTER:
return -1;
break;
case NIC_CONV_ASTATE:
return -1;
break;
case NIC_CONV_MEDIA:
return -1;
break;
case NIC_CONV_MEDIA_RATE:
sprintf(value,"%d",nic->media_rate);
break;
case NIC_CONV_MTU:
sprintf(value,"%d",nic->mtu);
break;
case NIC_CONV_LAN:
sprintf(value,"%d",nic->lan);
break;
case NIC_CONV_NODE:
sprintf(value,"%d",nic->node);
break;
case NIC_CONV_CFG:
return -1;
break;
case NIC_CONV_PHY:
return -1;
break;
case NIC_CONV_MAC_LEN:
return -1;
break;
case NIC_CONV_PERMANENT_MAC:
MACtoString(nic->permanent_address,value,nic->mac_length);
break;
case NIC_CONV_CURRENT_MAC:
MACtoString(nic->current_address,value,nic->mac_length);
break;
// these are all in GenStats_t
case NIC_CONV_MEDIUM:
return -1;
break;
case NIC_CONV_XMIT_OK:
sprintf(value,"%d",nic->nstats.gstats.xmit_ok);
break;
case NIC_CONV_RCV_OK:
sprintf(value,"%d",nic->nstats.gstats.rcv_ok);
break;
case NIC_CONV_XMIT_ERROR:
sprintf(value,"%d",nic->nstats.gstats.xmit_error);
break;
case NIC_CONV_RCV_ERROR:
sprintf(value,"%d",nic->nstats.gstats.rcv_error);
break;
case NIC_CONV_MULTICAST_XMIT:
sprintf(value,"%d",nic->nstats.gstats.multicast_xmit);
break;
case NIC_CONV_MULTICAST_RCV:
sprintf(value,"%d",nic->nstats.gstats.multicast_rcv);
break;
case NIC_CONV_BROADCAST_XMIT:
sprintf(value,"%d",nic->nstats.gstats.broadcast_xmit);
break;
case NIC_CONV_BROADCAST_RCV:
sprintf(value,"%d",nic->nstats.gstats.broadcast_rcv);
break;
// these are all in EthernetStats_t
case NIC_CONV_RCV_ALIGNMENT_ERROR:
sprintf(value,"%d",nic->nstats.un.estats.rcv_alignment_error);
break;
case NIC_CONV_XMIT_COLLISIONS:
sprintf(value,"%d",nic->nstats.un.estats.xmit_collisions);
break;
case NIC_CONV_RCV_OVERRUN:
sprintf(value,"%d",nic->nstats.un.estats.rcv_overrun);
break;
case NIC_CONV_XMIT_UNDERRUN:
sprintf(value,"%d",nic->nstats.un.estats.xmit_underrun);
break;
case NIC_CONV_XMIT_CRS_LOST:
sprintf(value,"%d",nic->nstats.un.estats.xmit_crs_lost);
break;
case NIC_CONV_RCV_CRC_ERROR:
sprintf(value,"%d",nic->nstats.un.estats.rcv_crc_error);
break;
case NIC_CONV_RCV_LENGTH_ERROR:
sprintf(value,"%d",nic->nstats.un.estats.rcv_length_error);
break;
case NIC_CONV_RCV_COLLISIONS:
sprintf(value,"%d",nic->nstats.un.estats.rcv_collisions);
break;
case NIC_CONV_RCV_DRIBBLE:
sprintf(value,"%d",nic->nstats.un.estats.rcv_dribble);
break;
case NIC_CONV_XMIT_ABORTED:
sprintf(value,"%d",nic->nstats.un.estats.xmit_aborted);
break;
case NIC_CONV_XMIT_CDH:
sprintf(value,"%d",nic->nstats.un.estats.xmit_cdh);
break;
case NIC_CONV_XMIT_WINDOW:
sprintf(value,"%d",nic->nstats.un.estats.xmit_window);
break;
case NIC_CONV_XMIT_DEFERRED:
sprintf(value,"%d",nic->nstats.un.estats.xmit_deferred);
break;
case NIC_CONV_XMIT_JABBER:
sprintf(value,"%d",nic->nstats.un.estats.xmit_jabber);
break;
case NIC_CONV_XMIT_SQE:
sprintf(value,"%d",nic->nstats.un.estats.xmit_sqe);
break;
case NIC_CONV_LINK_FAILURE:
sprintf(value,"%d",nic->nstats.un.estats.link_failure);
break;
default:
return -1;
break;
}
return 0;
}



Any use to you?