automate juniper switch backup

From KB11194 http://kb.juniper.net/InfoCenter/index?page=content&id=KB11194

JUNOS Command Line interface allows the user to export the configuration file into an FTP server and to import it back to the switch. The information below describes the steps to backup and restore JUNOS configuration file on FTP server.

Backup configuration file on FTP.

The following configuration sample shows how to backup the JUNOS configuration file on FTP server.

On every commit applied on CLI, the EX switch will transfer a copy of the configuration file to an ASCII file on FTP server. The filename created on the FTP server contains hostname, date and time signature.

system {

archival {

configuration {

transfer-on-commit;

archive-sites {

“ftp://username:password@172.30.36.59″;

}

}

}

}

A first chance exception of type ‘System.DllNotFoundException’ occurred in System.Data.SQLite.dll solution

Copy all the .dlls from System.Data.SQLite\2010\bin into your debug\release bin

Use rConfig to backup an F5

Don’t bother

Just download the F5 backup appliance

http://sourceforge.net/projects/f5configbackup/

http://sourceforge.net/p/f5configbackup/wiki/Appliance1.0/

How to actually get the AS400 oledb connection with .net

Get yourself a copy of DB2OLEDBV4_x86.msi (or a 64 bit version DB2OLEDBV4_x64.msi)

Get yourself the Microsoft Visual C++ Redistributable Package http://www.microsoft.com/en-us/download/confirmation.aspx?id=8328

Or get the 64bit version as well

Install yourself a version of SQL Server 2008 or later version

And… get yourself a copy of .net 4.0 yeesh

OK….. after fighting that for way too long time to try the IBM odbc driver.

It is downloaded from here

https://www-304.ibm.com/support/docview.wss?uid=swg27016878

Have fun getting an account and getting the Driver for ODBC and CLI (64-bit) downloaded

Then unzip it and run

cd <uncompressed driver folder>/bin
db2cli install -setup

Now I have a new data source called IBM DB2 ODBC DRIVER

Scratch that, I finally got the stupid OLEDB driver to work. The key is to use verbatim string literal (which doesn’t exist in vb.net) So instead use <![CDATA[
SELECT * FROM [TABLE] where RTTICK = ‘852’
]]>.Value

From this post

https://mikearnett.wordpress.com/2013/04/12/query-db2-from-net/#comment-650

Dim connectionString As String = “Provider=DB2OLEDB;User ID=;Password=;Initial Catalog=;Network Transport Library=TCPIP;Host CCSID=1208;PC Code Page=1252;Network Address=;Network Port=446;Package Collection=;Default Schema=;Units of Work=RUW;Default Qualifier=;DBMS Platform=DB2/AS400;Use Early Metadata=False;Defer Prepare=False;DateTime As Char=False;Rowset Cache Size=0;Binary CodePage=0;Datetime As Date=False;AutoCommit=True;Database Name=;Authentication=Server;Decimal As Numeric=False;Derive Parameters=True;LoadBalancing=False;Persist Security Info=True;Cache Authentication=False;Connection Pooling=False;”

Using connection = New OleDbConnection(connectionString)

Dim command = New OleDbCommand()
command.CommandText = <![CDATA[
SELECT * FROM [TABLE] where RTTICK = ‘852’
]]>.Value

command.Connection = connection
connection.Open()
Dim reader = command.ExecuteReader()
If reader.HasRows Then
While reader.Read()
System.Diagnostics.Debug.Write(reader.GetValue(1))
End While
reader.Close()
End If
connection.Close()
End Using

How to backup a sonicwall using rConfig

You can’t, at least not very easily.

So http://www.rconfig.com/ is pretty cool.

Unfortunately / fortunately (depending on your perspective) the creator of it got a more busy job at Dell, and hasn’t really been working on it any more.

So, there is a fair amount of chatter about how to get it to work for this or that. But really, the easiest way is to use a Bash Script on a linux box.

Like noted here http://sickbits.net/automated-backups-of-a-sonicwall-nsa-or-other-device-w-expect/

or

Here http://community.spiceworks.com/scripts/show_download/2543

The spiceworks script is a little more robust but same idea.

#!/bin/bash
###########################################################################
# Shell Script to backup Appliances SonicWALL firmware version 5.9 and above#
###########################################################################
# Variation affects Firmware backup commands of fwares before 5.9#
###########################################################################
##2
# Author : Ernander Marcus Lataliza Rosendo# Ernander<@>Gmail.com
# Last Change : Henrique Duarte#
##
##
###########################################################################
# VERSION : 1.1 | Last modified on 31/03/2014 17:45 pm#
##
# Fix :#
# Added date and time in the exported file#
# Added variable ” log “#
###########################################################################

# VARIABLE
#
# Do not remove the quotation marks :
#
# Directory for the log
DATE_TIME_UNDERLINE=$(date +%d”-“%m”-“%y”_”%H”:”%M)
DATE_TIME_PIPE=$(date +%d”-“%m”-“%y”|”%H”:”%M)
log=”/var/log/sonicwall_bkp.log”
# User Sonicwall | IF YOU CHANGES IN THE NAME OF ADMIN SYSTEM> PREFERENCES CHANGE THE VARIABLE LOGIN
login=”admin”
# Password sonicwall
password=”PASSWORD”
# Address sonicwall | IP OR FQDN
host=”192.168.168.168″
/usr/bin/expect <<EOF
spawn ssh $login@$host
expect -re “.*?assword:”
send “$password\n”
expect -re “>”
send “export current-config sonicos ftp ftp://USER_FTP:PASSWORD_FTP@IP_SERVER_FTP/bkp-SonicWall-$DATE_TIME_UNDERLINE.exp\n”

expect -re “>”
send “exit\n”
EOF

if [ $? = 0 ] ; then
echo ” $DATE_TIME_PIPE $host BKP done successfully!”;
else
echo “$DATE_TIME_PIPE – $host BKP HAS NOT BEEN DONE!”
fi

echo done

BizLink install part 3

Now that we got some AS2 action going on I needed to figure out how to handle some incoming purchase orders. With a little bit of poking around I was able to get it to go.

The first thing I needed to configure was the ‘parties’

I wanted to emulate an invoice coming in so I took the external partner and set their identifiers to match a real partner but it was really pointing my other AS2 box. Then for the server owner I set it to one of our real id’s. These Identities are not AS2 identities but are ISA (EDI x12) identities. So for example the EDI might be like

ISA*00*          *00*          *ZZ*666791NF       *08*999485US00

you would set the server owner to ZZ 666….  and the external to 08 999…

on this screen

parties

 

So now you have parties setup, but now we need to instruct BizLink what to do with the files when it gets them!

The simplest thing to do is under transports, set a file copy (upload) on your server owner, set the file path and the format of how you want the file named and you will be good to go.

Transports

That will work, but what if you want say all 810’s from a certain partner to go to a certain directory? In this case create another File Copy (Upload) rename it to say Export Walmart 810 and then set its export folder to a 810 walmart specific one. That’s all nice and dandy but what actually tells it to use that particular export? The processing rules of course!

processing rulesGo ahead and click add, to add a new processing rule. We want a Recipient rule (for when our server is the recipient)

First give it a name.

rules1

Then you get to set the conditions they can either be AND or they can be OR conditions. We want an AND so both conditions evaluate as true.

conditions

We set the Sender Qualifier + Id to match our sender ID (in the ISA) and the we set the Transaction_IdCode to = 810.

Ok, now we need to tell it an action to do when the conditions are met.

Set that underneath in the actions dialogue

actions

The first action will send back a 997 if requested and the second is for the routing. If we looking into the routing rule it is simple enough, give it a name, and then select a transport.

routing

There you have it, when the doc matches it will get exported to the correct folder. Next we will mess with some scripts, until next time.

Cool visio diagrams of common server components

http://www.visiocafe.com/index.htm

For IBM it has back and forward views, and in a separate download it has NICs and other cards to insert as well!

Oh yeah, to rotate things in visio, go to View, Task Panes, size and position.

Follow

Get every new post delivered to your Inbox.

Join 245 other followers