cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1431
Views
0
Helpful
10
Replies

Batch change SNMP community string in IPM 2.5.1?

yjdabear
VIP Alumni
VIP Alumni

Is there any easy way to batch modify all the SNMP community strings in IPM 2.5.1?

1 Accepted Solution

Accepted Solutions

nhabib
Level 9
Level 9

If you are on Solaris, try the following:

- create a text file, let's call it comm.dat in /opt

- the file should contain the list of devices and new community strings in this format:

u 10.10.10.10 public yjdabear

u 10.10.10.12 public yjdabear

where u = update

2nd col = device name (as it shows up in IPM)

3rd col = new read community name

4th col = new read write community name

- issue the command:

/opt/CSCOipm/bin/ipm loadsrc /opt/comm.dat

(might get a VisiBroker error message here, it can be ignored)

View solution in original post

10 Replies 10

nhabib
Level 9
Level 9

If you are on Solaris, try the following:

- create a text file, let's call it comm.dat in /opt

- the file should contain the list of devices and new community strings in this format:

u 10.10.10.10 public yjdabear

u 10.10.10.12 public yjdabear

where u = update

2nd col = device name (as it shows up in IPM)

3rd col = new read community name

4th col = new read write community name

- issue the command:

/opt/CSCOipm/bin/ipm loadsrc /opt/comm.dat

(might get a VisiBroker error message here, it can be ignored)

Thanks. I assume this is safe, that it only updates the Source, without touching anything else such as Target/Operations/etc.? Can I let "ipm export" save me the trouble of starting from scratch with comm.dat? Where is "ipm exporting" writing to?

Yes, you may use the export to create the comm.dat

I haven't done this in a while, so you might want to test it with a couple devices at first.

I ran "ipm export -q -s" (no column heading, Source only). The prompt came back right away. I don't know where to look for the exported data, if any.

When I ran it, the output was displayed on the screen.

I was also able to output it to a file by issuing the command:

/opt/CSCOipm/bin/ipm export -q -s > /tmp/ipm-export

Heh, it's weird here. Here're my results:

ipm export -q -s ==> nada

ipm export -q ==> nothing

ipm export -q > /tmp/ipm.txt ==> /tmp/ipm.txt is empty

ipm export -s ==> Source with column heading

ipm export -s -q ==> Source without column heading

ipm export -q -s ==> Source without column heading

Weird indeed. Good thing you have them now.

I'm so far unable to update the SNMP commm strings successfully.

Enter password:

Please check the /tmp/ipm2.txt.out file and message log for status.

=================================================

Loading of sources into database complete.

Press return key to continue.

=================================================

u,ab2621saa1|ab2621saa1,read,write - OK

u,cd2621saa1|cd2621saa1,read,write - OK

u,172.18.23.3|cd2621saa2 e1-1,read,write - OK

172.18.23.3 is the "Hostname or IP address" shown in the GUI (Edit -> configuration). "cd2621saa2 e1-1" is the Alias Name. But none of the threes "OK"s are updated. I even closed and re-opened the GUI Windows IPM client.

Here's the output of "ipm export -s"

AliasName,HostName,IPAddress,ReadCommunity,WriteCommunity,IOSVersion,SAAVersion,

MaxData,LastTimeSet,MaxColl,UpTime

ab2621saa1,ab2621saa1,10.54.31.53,read,write,12.2(6a),2.2.0 Round Trip Time

MIB,16384,1060705775,500,187132788

cd2621saa1,cd2621saa1,10.54.30.53,read,write,12.2(6a),2.2.0 Round Trip Ti

me MIB,16384,1060705633,500,196106411

cd2621saa2 e1-1,172.18.23.3,172.18.23.3,read,write,12.2(13b),2.2.0 Round Trip

Time MIB,16384,1085113138,496,1035471140

etc/source/srfile.

###############################################################################

#

# This file has example definitions for source routers.

#

# Comments starts with the "#" character

#

# The format of the file is as follows:

#

#

#

# characters are " ;,\t" "space,semicolon,comma,tab"

#

# : Hostname followed by optional aliasName

# seperated with a '|' ("vertical bar")

#

# The valid commands are 'a|A' for add; 'd|D' for delete; 'u|U' for update;

#

# WARNING: Please assure the permissions on these files

# do not allow read access to all users due to

# the inclusions of SNMP community names.

#

# NOTE: In case hostname and aliasname are different

# it is mandatory to provide both. In that case

# aliasname is not an optional paramater.

###############################################################################

#a router1 public private

#a router2|routerInLab santa claus

#a router3.foobar.com open secret

The reason it fails for the last one is that the AliasName is not the same as the HostName

Does the AliasName have a space in it?

If not, then your last line would be:

u,172.18.23.3|cd2621saa2e1-1,read,write

If it does have a space in it, that will cause problems as space is a delimiter.

As far as to why the changes did not take effect, I wouldn't know. Sorry.

I edited my previous post, because I made all three "OK" after I saw this paragraph in etc/source/srcfile:

# NOTE: In case hostname and aliasname are different

# it is mandatory to provide both. In that case

# aliasname is not an optional paramater.

My only speculation right now on why it's not updating is maybe that's by design when there're IPM clients running. I know for sure there's someone else running IPM other than me at the moment.