Jun
08
Posted by jbjorkman on June 8, 2010 under
Deprecated: preg_replace() [
function.preg-replace]: The /e modifier is deprecated, use preg_replace_callback instead in
/var/www/myfoto.se/jbits.se/blog/wp-includes/formatting.php on line
82
Uncategorized
Sometimes doing a hot conversion might be troublesome, in those cases it might be good to know you still have the option to do a cold conversion.
Get the bootable cd for it at http://www.vmware.com/download/download.do?downloadGroup=VC250U4
Jun
08
Posted by jbjorkman on June 8, 2010 under
Cisco
I made this little script to be able to retrieve log data from any cisco device via snmp.
Unfortunately most devices seem to have a default setting that only keeps the last line in history, this can however be increased by entering: logging history [numlines] in config mode.
Our table is located in Cisco-SysLog-MIB and has the following OID: 1.3.6.1.4.1.9.9.41.1.2.3
The following steps must be taken to allow access to this Mib via WMI:
- Install WMI SNMP Provider ( A Windows component )
- Download the following mibfiles:
CISCO-SYSLOG-MIB.mib
CISCO-SMI.mib
SNMP-FRAMEWORK-MIB.mib
INET-ADDRESS-MIB.mib
- Run the SNMP information module compiler smi2smir.exe (located in C:\WINDOWS\system32\wbem\snmp) to compile a mof from your mibfiles
smi2smir.exe /g CISCO-SYSLOG-MIB.mib CISCO-SMI.mib SNMP-FRAMEWORK-MIB.mib INET-ADDRESS-MIB.mib > cisco-syslog-mib.mof
- Run mofcomp.exe (located in C:\WINDOWS\system32\wbem) to install your newly created mof into the WMI repository:
mofcomp.exe cisco-syslog-mib.mof
Finally, here's the script to make it all happen:
| Option Explicit
Dim strSNMPCmnt, strSNMPTarget
Dim objWmiLocator, objWmiServices, objWmiNamedValueSet
Dim colLogTable, objLogEntry, strLogEntry
strSNMPCmnt="public"
strSNMPTarget="172.16.0.1"
Set objWmiLocator = CreateObject("WbemScripting.SWbemLocator")
Set objWmiServices = objWmiLocator.ConnectServer("","root\snmp\localhost")
Set objWmiNamedValueSet = CreateObject("WbemScripting.SWbemNamedValueSet")
objWmiNamedValueSet.Add "AgentAddress", strSNMPTarget
objWmiNamedValueSet.Add "AgentReadCommunityName", strSNMPCmnt
Set colLogTable = objWmiServices.InstancesOf("SNMP_CISCO_SYSLOG_MIB_clogHistoryTable", , objWmiNamedValueSet)
For Each objLogEntry In colLogTable
with objLogEntry
strLogEntry= "Facility:" & .clogHistFacility & vbCRLF & _
"Index: " & .clogHistIndex & vbCRLF & _
"Severity: " & .clogHistSeverity & vbCRLF & _
"Timestamp: " & .clogHistTimestamp & vbCRLF & _
"MsgName: " & .clogHistMsgName & vbCRLF & vbCRLF & _
.clogHistMsgText
End with
WScript.Echo strLogEntry
next
Set colLogTable=Nothing
Set objWmiNamedValueSet=Nothing
Set objWmiServices=Nothing
Set objWmiLocator=Nothing |