nv-l
[Top] [All Lists]

Re: snmpcdmp (snmpColDump)

To: nv-l@lists.tivoli.com
Subject: Re: snmpcdmp (snmpColDump)
From: Michael Seibold PTS/M-SW <mseibold@STR.DAIMLER-BENZ.COM>
Date: Wed, 14 Oct 1998 13:54:01 +0200
Reply-to: Discussion of IBM NetView and POLYCENTER Manager on NetView et alia <NV-L@UCSBVM.UCSB.EDU>
Sender: Discussion of IBM NetView and POLYCENTER Manager on NetView et alia <NV-L@UCSBVM.UCSB.EDU>
Hi Matt,

I think we all have the same problem producing reports. The easiest way
to produce reports from routers seems to be mrtg, but then we double the
work - every device has to be configured and maitained in netview and in
mrtg.
Up to now netview doesn't provide the needed functionality for
reporting, so I also tried something else.

I use netview to collect data and gnuplot to produce graphs. To produce
output similar to mrtg I exported the data with snmpColDump and did a
grep for the wanted date / device, but this is very slow with big data
files and the CPU of the machine running netview and the reporting was
very busy, which caused netmon to get problems.

To solve this I exported the /usr/OV/databases/snmpCollect via NFS to a
linux-system (very cheap ;-)) and wrote a little C routine which reads
the binary data from snmpCollect, looks for the wanted date/ip-address
etc., converts the AIX-floatingpoint-values to intel representation
(have to swap bytes) and writes out binary / ascii data as wanted. This
way it is much faster than using snmpColDump / grep /awk etc., and the
CPU of the Netview-Server has only the NFS-Requests to handle with.

My tool isn't as comfortable as mrtg at the moment, and I have not the
time to finish this at the moment. Using mrtg to graph would save a lot
of work, I think.

As I wrote the programm during work I am not allowed to give it away,
but if someone would like to follow this solution here is the key to
read the binary data from snmpCollect:

...
    unsigned long startt, endt, ip;
    unsigned char ip1, ip2, ip3, ip4;
    double data;
    char *p;
...

        read(fin,&startt,sizeof(startt));
        read(fin,&endt,sizeof(endt));
        read(fin,&ip,sizeof(ip));
        read(fin,&data,sizeof(data));

...

        if ( debug )
          {
            printf("\n\n");
            printf("%ld\t%ld\t%lu\t%lf\n",startt, endt, ip, data);
            printf("%X\t%X\t%X\t%X %X\n",startt, endt, ip, data,
&data+4);
          }
...
        /* Unix (AIX) to Intel-float */

        resort_4((char *)&startt);
        resort_4((char *)&endt);
        swap_8((char *)&data);
        resort_4((char *)&data);
        resort_4((char *)&data+4);


        /* break IP - address into parts */
        p=(char *)&ip;

        ip1=*p++;
        ip2=*p++;
        ip3=*p++;
        ip4=*p;


...


/* resort 4 Bytes (Integer Unix -> Intel) */

void resort_4(inp)
char *inp;
{
    char buf[4];
    char *p1, *p2;
    int i;


    memcpy(buf, inp, 4);        /* alte Daten retten */

    p1=inp;                     /* Zeiger auf Datenanfang */
    p2=buf+3;                   /* Zeiger auf Pufferende  */

    for ( i=0; i<4;i++ )
      { *p1++=*p2--; }          /* umkopieren             */
}


/* swap 8 Bytes (long Float) 4 Bytes at a time (Unix -> Intel) */

void swap_8(inp)
char *inp;
{
    char buf[4];

    memcpy(buf, inp, 4);        /* 1. Datenteil retten */
    memcpy(inp, inp+4, 4);      /* 2. Datenteil nach vorne schieben */
    memcpy(inp+4, buf, 4);      /* 1. Datenteil zurueckholen */

}

...


Sorry for not providing the whole program and for the german comments.

Maybe we should start a little projekt on reporting during our
spare-times, I think we would get rid of a lot of trouble during work
with a good reporting tool...


Cheers

Michael Seibold



Matt Moore wrote:
>
> Hi,
>
> I am attempting to collect data with netview 5.0a for NT, and graph the
> collected data with MRTG (as opposed to letting MRTG collect the data).
> I was thinking of using snmpcdmp (netview for NT's version of
> snmpColDump) to get the data from the \usr\ov\databases\snmpcollect
> directory, and passing it to MRTG to graph. However, most of the time I
> get an error when I attempt to run snmpcdmp.
>
> When I run "snmpcdmp ifInOctets.2" I get the error
> "snmpcdmp: read(ifInOctets.2) failed: (null)"
>
> I have tried running snmpcdmp with all the specified options, but still
> get the same error.
> Has anyone else had any similar problems?
>
> Thanks,
> Matt Moore

<Prev in Thread] Current Thread [Next in Thread>

Archive operated by Skills 1st Ltd

See also: The NetView Web