We have several systems which have all devices configured in them, one of which is CiscoWorks. In our enviromnet our DNS is considered the master list of devices that are being managed.
I am writing a script which queries the DNS to get a list of all devices and their IP addresses, and I would like to query CiscoWorks and get a list of all devices and their management IP addresses.
The script will be run from a remote server (as far as CiscoWorks is concerned).
I can use the CW servlet, rme/cwcli, to extract information, eg
cwtest.pl http://server:1741/rme/cwcli cwtest.file
wher cwtest.file contains
cwcli export inventory -u username -p password -ipaddress 192.168.24.12
This returns XML formatted info on this device.
What is missing from this information is the management IP address for this device.
Ideally I want to extract information using the -view option for all devices, but if I cant get the management IP address it makes life a bit trickier.
I am wondering if I am using the wrong command, ie something other than cwcli export inventory.
Can anyone tell me how to get the management IP address for a device using this method?
You want to get the DCR information from this device using the Device List Manipulation Service. See http://server/help/rme/fundamentals/device_GettingIPAddress.html for more details.
Thanks. This looks promising. I havent been able to test this fully yet as I am using PERL and I am getting a few errors which obviously relate to modules which I havent installed, or installed properly.
This might be a little bit off topic, but I cant get this to work using my PERL script as I keep getting the following error:
Can't locate auto/Compress/Zlib/autosplit.ix in @INC (@INC contains: /usr/local/OV/perl/lib /opt/OV/bin/Perl/lib/perl5/5.6.0/sun4-solaris /opt/OV/bin/Perl/lib/perl5/5.6.0 /opt/OV/bin/Perl/lib/perl5/site_perl/5.6.0/sun4-solaris /opt/OV/bin/Perl/lib/perl5/site_perl/5.6.0 /opt/OV/bin/Perl/lib/perl5/site_perl .) at /opt/OV/bin/Perl/lib/perl5/5.6.0/AutoLoader.pm line 133,
at /usr/local/OV/perl/lib/Compress/Zlib.pm line 6
CWTEST2: After getting response to request...
Response: 500 Can't locate loadable object for module HTML::Parser in @INC (@INC contains: /usr/local/OV/perl/lib /opt/OV/bin/Perl/lib/perl5/5.6.0/sun4-solaris /opt/OV/bin/Perl/lib/perl5/5.6.0 /opt/OV/bin/Perl/lib/perl5/site_perl/5.6.0/sun4-solaris /opt/OV/bin/Perl/lib/perl5/site_perl/5.6.0 /opt/OV/bin/Perl/lib/perl5/site_perl .)
500 Can't locate loadable object for module HTML::Parser in @INC (@INC contains: /usr/local/OV/perl/lib /opt/OV/bin/Perl/lib/perl5/5.6.0/sun4-solaris /opt/OV/bin/Perl/lib/perl5/5.6.0 /opt/OV/bin/Perl/lib/perl5/site_perl/5.6.0/sun4-solaris /opt/OV/bin/Perl/lib/perl5/site_perl/5.6.0 /opt/OV/bin/Perl/lib/perl5/site_perl .)
I am tyring to get this to work on a Solaris 9 platform, which is used to run HP NNM and I am using the version of PERL which comes with NNM (5.6.1). It is not connected directly to Internet and does not have much in the way of compilers etc, so I have been manually downloading what I think are the required libraries and copying the files in the lib directories to the appropriate /usr/local/OV/perl/lib directory, which I use as my site libary directory. I have done this sort of thing in the past with other libraries, eg Net-IP and Net-DNS and all works well.
I started off loading the libwww-perl-5.805 libraries so I could use the use LWP::UserAgent command required to interface with the Device List Manipulation Service, but then there were all the prerequisite libraries....
I have downloaded the following libraries from CPAN, but I cannot find any reference to this autosplit.ix file. (In alphabetical order)
I confess my understanding of PERL is not an expert level. I learn enough to get me by as it is not my focus, so if anyone can tell me what bit I am missing it would be most appreciated.
You're missing parts of the Compress::Zlib module. The package list contents should be:
The autosplit.ix file should contain:
# Index created by AutoSplit for blib/lib/Compress/Zlib.pm
# (file acts as timestamp)
However, you really should use NMSROOT/bin/perl. While currently a bit older, it has all the necessary modules to interface with LMS using both HTTP and HTTPS.
Believe me I really would like to use the NMSROOT/bin/perl but these modules arent in it. My methodology in installing the modules has an inherent flaw in it me thinks.
Having created the file with the contents specified, I have now moved on to the next problem which is:
Can't locate HTML/Parser.pm in @INC (@INC contains: /usr/local/OV/perl/lib /opt/OV/bin/Perl/lib/perl5/5.6.0/sun4-solaris /opt/OV/bin/Perl/lib/perl5/5.6.0 /opt/OV/bin/Perl/lib/perl5/site_perl/5.6.0/sun4-solaris /opt/OV/bin/Perl/lib/perl5/site_perl/5.6.0 /opt/OV/bin/Perl/lib/perl5/site_perl .) at ./cwtest2.ovpl line 5.
where the file starts with:
use lib '/usr/local/OV/perl/lib';
Doing a quick scan on the Internet I find references to requiring a file called auto/HTML/Parser/Parser.so, which surprisingly enough I dont have. It looks to me like this is supposed to be created when doing a make on the library. I am not doing this but copying the files from the distribution. The distribution doesnt have it so I am stuck.
I will keep looking, but if anyone has any ideas that would be great.
Which modules are missing from CiscoWorks' Perl? It has HTML::Parser. It has LWP. I have used it to interface with DLMS successfully.
However, it looks like you are now missing HTML::Parser from your @INC path. The package list from HTML parser (which includes compiled code) should be:
Since this module contains compiled code, you WILL need to compile it for Solaris to produce the shared object. Again, CiscoWorks' Perl should have everything you need for interfacing with DLMS.
Aha. I think we are at cross purposes here. I am running PERL from our HP NNM server (Solaris), and trying to talk to our CiscoWorks servers wunning on Windows. As such I dont have the CiscoWorks PERL installed on our SOlaris box.
I am talking to our Unix people to see what is involved in getting the compiler put onto the server, as I see this the only way forward.
Thanks for your help.
Ah, I completely misunderstood. If you're looking for an easy way to get and maintain pre-compiled Solaris packages, I use Blastwave (http://www.blastwave.org) on all of my Solaris servers. This allows me to install all of the development and troubleshooting tools I need for CiscoWorks without the hassle of having to track down dependencies myself.
I have been given access to another Solaris box with a compiler on it and have now happily, and I think successfully, got all the modules I need to get the LWP::UserAgent module working. Yeehah.
I now run my test script and get the following message:
Failure: LWP will support https URLs if the Crypt::SSLeay module is installed.
I presume this is occuring a) because I dont have this module installed, and b) because CW uses SSL when authenticating.
Looking at the README for this module, it looks like I have to install the OpenSSL package. DO you know if this is correct?
What URL are you using? If LMS is configured for HTTP (e.g. you go to 1741 for access) you should not need crypto as the DLMS interface does not go through the regular authentication channels. However, if your server is confgiured for HTTPS access, you will need crypto support which means SSLeay which means OpenSSL.
Our CiscoWorks servers are set up to use port 1741, http.
That is good news that I dont need the SSLeay.
Is there any logs that I can view to see my connection attempts and other access attempts? I cant see anything useful in the logs, so maybe there is some debug level I need to change.
Aha!! I went back and compared my script with the sample from the doc you referred me to earlier. I noticed that I had changed the http command from POST to GET as part of my trying to get things working.
After changing that and a typo in my URL string I now get...
CWTEST2: URL to use: http://cwserver:1741/rme/com.cisco.nm.rmeng.inventory.servlet.DeviceListService
CWTEST2: After UA assignment...
CWTEST2: After request assignment...
CWTEST2: After getting response to request...
CWTEST2: Status: 500 Internal Server Error
type Exception report
message Internal Server Error
description The server encountered an internal error (Internal Server Error) that prevented it from fulfilling this request.
Not sure if there is much hope... :-(
Without seeing your code, it's impossible to know for sure, but this error makes it seem like you are not uploading the XML source file correctly. A while back, I wrote a tool called DevExp which worked with DLMS in RME 3.1 and higher. I have just adapted it for RME 4.0 (attached). It works, and should give you a good Perl example of how this should work. The code is BSD licensed.
I have modified your script slightly to output the IP addresses and it all works!!!
Many thanks for your patience and script.