[c-nsp] SNMP / CISCO-FLASH-MIB questions

Peter Rathlev peter at rathlev.dk
Mon Oct 13 18:40:40 EDT 2008


Hello all,

I have a small SNMP question regarding some scripts I'm writing for
automation of file services on a bunch of small routers and access
switches (C2600/2800 and Cat3560 primarily).

I'd like to automate the deletion of e.g. anything with a name
containing "html" or maybe old images after an upgrade, and for that I
figured using a combination of walking ciscoFlashFileName and using
ciscoFlashMiscOpEntry commands would do the trick. I can delete all the
regular files with no problems, but I can't seem to figure out how to
delete directories.

If I specify the directory name with the trailing slash, as
ciscoFlashFileName gives it to me, it returns "miscOpInvalidDestName",
and if I try without the trailing slash I get "miscOpFileOpenError".

With the slash:

[prathlev at einstein ~]# TARGET="test-c3560.net.rm.dk"
[prathlev at einstein ~]# RND=$RANDOM
[prathlev at einstein ~]# snmpset $SNMP_OPTS $TARGET \
> CISCO-FLASH-MIB::ciscoFlashMiscOpCommand.$RND i delete \
> CISCO-FLASH-MIB::ciscoFlashMiscOpDestinationName.$RND s flash:/c3560-ipbase-mz.122-25.SEE3/html/ \
> CISCO-FLASH-MIB::ciscoFlashMiscOpEntryStatus.$RND i createAndGo
CISCO-FLASH-MIB::ciscoFlashMiscOpCommand.32433 = INTEGER: delete(3)
CISCO-FLASH-MIB::ciscoFlashMiscOpDestinationName.32433 = STRING: flash:/c3560-ipbase-mz.122-25.SEE3/html/
CISCO-FLASH-MIB::ciscoFlashMiscOpEntryStatus.32433 = INTEGER: createAndGo(4)
[prathlev at einstein ~]# snmpget $SNMP_OPTS $TARGET \
> CISCO-FLASH-MIB::ciscoFlashMiscOpStatus.$RND
CISCO-FLASH-MIB::ciscoFlashMiscOpStatus.32433 = INTEGER: miscOpInvalidDestName(4)
[prathlev at einstein ~]# 

Without the slash:

[prathlev at einstein ~]# RND=$RANDOM
[prathlev at einstein ~]# snmpset $SNMP_OPTS $TARGET \
> CISCO-FLASH-MIB::ciscoFlashMiscOpCommand.$RND i delete \
> CISCO-FLASH-MIB::ciscoFlashMiscOpDestinationName.$RND s flash:/c3560-ipbase-mz.122-25.SEE3/html \
> CISCO-FLASH-MIB::ciscoFlashMiscOpEntryStatus.$RND i createAndGo
CISCO-FLASH-MIB::ciscoFlashMiscOpCommand.17488 = INTEGER: delete(3)
CISCO-FLASH-MIB::ciscoFlashMiscOpDestinationName.17488 = STRING: flash:/c3560-ipbase-mz.122-25.SEE3/html
CISCO-FLASH-MIB::ciscoFlashMiscOpEntryStatus.17488 = INTEGER: createAndGo(4)
[prathlev at einstein ~]# snmpget $SNMP_OPTS $TARGET \
> CISCO-FLASH-MIB::ciscoFlashMiscOpStatus.$RND
CISCO-FLASH-MIB::ciscoFlashMiscOpStatus.17488 = INTEGER: miscOpFileOpenError(9)
[prathlev at einstein ~]# 

I can't seem to find anything in CISCO-FLASH-MIB that would point at
directories being special or what to do with them. :-|

Is there any way to delete directories using CISCO-FLASH-MIB, or maybe
another MIB? Or will expect scripts have to do?

TIA,
Peter




More information about the cisco-nsp mailing list