nv-l
[Top] [All Lists]

Re: [NV-L] CLI to determine whether or not IP address known ???

To: Tivoli NetView Discussions <nv-l@lists.ca.ibm.com>
Subject: Re: [NV-L] CLI to determine whether or not IP address known ???
From: Leslie Clark <lclark@us.ibm.com>
Date: Thu, 12 Apr 2007 10:37:44 -0600
Delivery-date: Thu, 12 Apr 2007 17:38:16 +0100
Envelope-to: nv-l-archive@lists.skills-1st.co.uk
In-reply-to: <OF8422313D.74FC5067-ON852572BB.00557833-852572BB.0058E7CE@us.ibm.com>
List-help: <mailto:nv-l-request@lists.ca.ibm.com?subject=help>
List-id: Tivoli NetView Discussions <nv-l.lists.ca.ibm.com>
List-post: <mailto:nv-l@lists.ca.ibm.com>
List-subscribe: <http://lists.ca.ibm.com/mailman/listinfo/nv-l>, <mailto:nv-l-request@lists.ca.ibm.com?subject=subscribe>
List-unsubscribe: <http://lists.ca.ibm.com/mailman/listinfo/nv-l>, <mailto:nv-l-request@lists.ca.ibm.com?subject=unsubscribe>
Reply-to: Tivoli NetView Discussions <nv-l@lists.ca.ibm.com>
Sender: nv-l-bounces@lists.ca.ibm.com

I use a script that does this:

#!/bin/ksh
 
#set -x

ADDR=$1
if [ -z "$ADDR" ]
then echo "syntax is $0 ipaddress"
     exit
fi
         
ADADDR=$ADDR"AD"
RESULT=`/usr/OV/bin/nvUtil e '("IP Address" = '$ADDR') || ("IP Address" = '$ADADDR')'`
echo $ADDR $RESULT


If it is not found, it just returns the address you entered. If it is found, it includes the Selection Name of the interface object. That is, of course, the Selection Name of the parent node and the ifDescr or address for the interface, separated by a colon.

My script has, I am told, a really stupid name, so you should make up a better one.
I use another version that takes a list of addresses or names and returns this information, and for speed, it uses checks the output of a fresh ovtopodump instead of doing the nvUtil for each one.

#!/bin/ksh
#set -x

FILE=$1
if [ -z "$FILE" ]
then echo "syntax is $0 filename"
     echo "   where filename is a file that lists addresses."
     exit
fi
 
echo "# Getting fresh ovtopodump to search against."
TOPO=/tmp/topo.out
ovtopodump > $TOPO        


echo "# Addr, Name if input item  : node its on, status, address : input record"
while read -r RECORD
do
   ITEM=`echo $RECORD | cut -f1 -d"," | cut -f1 -d" "`
   if [ -z "$ITEM" ]
   then continue
   fi
   HOSTDATA=`/usr/OV/bin/nvgethost $ITEM `
# It returned something
   if [ -z "$HOSTDATA" ]
   then                              # item is a name that does not resolve, use as is
        RESULT=`grep "$ITEM " $TOPO | tail -1 | awk '{print $2,$3,$4}'`
        if [ -z "$RESULT" ]
        then RESULT="MISSING"
        fi
        echo "$ITEM unresolved : $RESULT : $RECORD"
   else
        NAME=`echo $HOSTDATA | cut -f1 -d" "`
        ADDR=`echo $HOSTDATA | cut -f3 -d" "`
        if [ "$NAME" = "$ADDR" ]
        then HOSTDATA="unresolved"     # an address that does not resolve (useless information)
        fi
        RESULT=`grep "$ADDR " $TOPO | tail -1 | awk '{print $2,$3,$4}'`
        if [ -z "$RESULT" ]
        then RESULT="MISSING"
        fi
        echo "$ADDR $NAME : $RESULT : $RECORD"
   fi

done < $FILE

Cordially,

Leslie A. Clark
IT Services Specialist, Network Mgmt
Information Technology Services Americas
IBM Global Services
(248) 552-4968 Voicemail, Fax, Pager



James Shanks/Raleigh/IBM@IBMUS
Sent by: nv-l-bounces@lists.ca.ibm.com

04/12/2007 12:11 PM
Please respond to
Tivoli NetView Discussions <nv-l@lists.ca.ibm.com>

To
Tivoli NetView Discussions <nv-l@lists.ca.ibm.com>
cc
Subject
Re: [NV-L] CLI to determine whether or not IP address known ???





NetView has no such tool. Perhaps someone else has already written one and will respond.

ovobjprint takes selection names as an argument, because it is ov-object-print and the objects in the database are known by their selection names. IP addresses are part of the TopM Interface list, which is an object property. We have no tools to search objects by properties.

Dumping the database seems easy enough to me, and you could write a script to search it with your IP addresses. Or you could use nvdbformat to write a report which lists just the interface list for each selection name if that would help. You could also dump the topology database with ovtopodump -lrv and search that if you would prefer.

But to search without dumping would require that you write your own application using the OVwDb API routines, such as OVwDbGetFieldVlaue, discussed in the Windows Programmer's Guide.

James Shanks
Level 3 Support for Tivoli NetView for UNIX and Windows
Network Availability Management
Network Management - Development
Tivoli Software, IBM Corp
Inactive hide details for Michael D Schleif <mds@helices.org>Michael D Schleif <mds@helices.org>

Michael D Schleif <mds@helices.org>
Sent by: nv-l-bounces@lists.ca.ibm.com

04/12/2007 11:12 AM
Please respond to
Tivoli NetView Discussions <nv-l@lists.ca.ibm.com>



To

nv-l mailing list <nv-l@lists.ca.ibm.com>

cc

Subject

[NV-L] CLI to determine whether or not IP address known ???




   M$ Windows Server 2003; SP1
  NV v7.1.4; FP04

Given a list of IP addresses, is there a CLI to determine whether or not
each address is already know to Netview, and already in the object
database?

ovobjprint appears to accept ONLY Selection Names.

Yes, I can dump the entire object DB, and query against the dump; but, I
would rather query by each individual address.

What do you think?

--
Best Regards,

mds
mds resource
877.596.8237
-
Dare to fix things before they break . . .
-
Our capacity for understanding is inversely proportional to how much
we think we know.  The more I know, the more I know I don't know . . .
--

(See attached file: signature.asc)
_______________________________________________
NV-L mailing list
NV-L@lists.ca.ibm.com
Unsubscribe:NV-L-leave@lists.ca.ibm.com

http://lists.ca.ibm.com/mailman/listinfo/nv-l (Browser access limited to internal IBM'ers only)
_______________________________________________
NV-L mailing list
NV-L@lists.ca.ibm.com
Unsubscribe:NV-L-leave@lists.ca.ibm.com
http://lists.ca.ibm.com/mailman/listinfo/nv-l (Browser access limited to internal IBM'ers only)

Attachment: signature.asc
Description: Binary data

_______________________________________________
NV-L mailing list
NV-L@lists.ca.ibm.com
Unsubscribe:NV-L-leave@lists.ca.ibm.com
http://lists.ca.ibm.com/mailman/listinfo/nv-l (Browser access limited to 
internal IBM'ers only)
<Prev in Thread] Current Thread [Next in Thread>

Archive operated by Skills 1st Ltd

See also: The NetView Web