Strict Standards: Redefining already defined constructor for class wpdb in /var/www/myfoto.se/jbits.se/blog/wp-includes/wp-db.php on line 56

Deprecated: Assigning the return value of new by reference is deprecated in /var/www/myfoto.se/jbits.se/blog/wp-includes/cache.php on line 36

Strict Standards: Redefining already defined constructor for class WP_Object_Cache in /var/www/myfoto.se/jbits.se/blog/wp-includes/cache.php on line 384

Strict Standards: Declaration of Walker_Page::start_lvl() should be compatible with Walker::start_lvl($output) in /var/www/myfoto.se/jbits.se/blog/wp-includes/classes.php on line 541

Strict Standards: Declaration of Walker_Page::end_lvl() should be compatible with Walker::end_lvl($output) in /var/www/myfoto.se/jbits.se/blog/wp-includes/classes.php on line 541

Strict Standards: Declaration of Walker_Page::start_el() should be compatible with Walker::start_el($output) in /var/www/myfoto.se/jbits.se/blog/wp-includes/classes.php on line 541

Strict Standards: Declaration of Walker_Page::end_el() should be compatible with Walker::end_el($output) in /var/www/myfoto.se/jbits.se/blog/wp-includes/classes.php on line 541

Strict Standards: Declaration of Walker_PageDropdown::start_el() should be compatible with Walker::start_el($output) in /var/www/myfoto.se/jbits.se/blog/wp-includes/classes.php on line 560

Strict Standards: Declaration of Walker_Category::start_lvl() should be compatible with Walker::start_lvl($output) in /var/www/myfoto.se/jbits.se/blog/wp-includes/classes.php on line 659

Strict Standards: Declaration of Walker_Category::end_lvl() should be compatible with Walker::end_lvl($output) in /var/www/myfoto.se/jbits.se/blog/wp-includes/classes.php on line 659

Strict Standards: Declaration of Walker_Category::start_el() should be compatible with Walker::start_el($output) in /var/www/myfoto.se/jbits.se/blog/wp-includes/classes.php on line 659

Strict Standards: Declaration of Walker_Category::end_el() should be compatible with Walker::end_el($output) in /var/www/myfoto.se/jbits.se/blog/wp-includes/classes.php on line 659

Strict Standards: Declaration of Walker_CategoryDropdown::start_el() should be compatible with Walker::start_el($output) in /var/www/myfoto.se/jbits.se/blog/wp-includes/classes.php on line 684

Deprecated: Assigning the return value of new by reference is deprecated in /var/www/myfoto.se/jbits.se/blog/wp-includes/query.php on line 21

Deprecated: Assigning the return value of new by reference is deprecated in /var/www/myfoto.se/jbits.se/blog/wp-content/plugins/code-highlighter/codehighlighter.php on line 42
jbits.se » 2010 » June » 08
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/kses.php on line 627

jbits.se

Jörgen Björkmans blog

Archive for June 8th, 2010

Jun
08

VMWare cold conversion bootable CD

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

Get Log from Cisco device via SNMP

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