[rancid] Re: Rancid and Syslog-ng

Meli, Federico Federico.Meli at GlobalCrossing.com
Thu Jul 23 13:58:55 UTC 2009


Sam,
        I included the attach with the previous mail but here you have the script.

        rancid.pl:
#########################

#!/usr/bin/perl
use warnings;
use strict;

# strip the priority
my $host;
$host=<>;

chomp($host);
$host=lc($host);

if ($host) {system("su - rancid -c \"/home/rancid/bin/rancid-run -r $host \" ");};


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

Federico Meli


From: Sam Munzani [mailto:smunzani at comcast.net]
Sent: Thursday, July 23, 2009 9:10 AM
To: Meli, Federico
Cc: rancid-discuss at shrubbery.net
Subject: Re: [rancid] Re: Rancid and Syslog-ng

The problem I faced with this approach is when the syslog-ng triggers the program, it memorizes that. So calling rancid-run script directly doesn't work. You need a wrapper script for this directive to work. From the configuration it looks like you have written rancid.pl wrapper. Can you share that to the team?

Thanks,
Sam

Hello everyone;
        I implemented the solution with the following syslog-ng modification and a script in perl. When the syslog receive a change configuration trap trigger the script. You should adapt it to your specific system. In this case the syslog translate the IP add from the hosts/DNS and I use that name. also I put the script in the log directory to avoid permit issues. Hopefully It will work for you.

Syslog.conf:

source net { udp(); };

filter f_change{ match("SYS-5-CONFIG_I: Configured"); };

destination df_change { program("perl /var/log/rancid.pl"
               template("$HOST\n") );
                };

log { source(net); filter(f_change); destination(df_change); };


Regards

Federico Meli
Global Crossing Americas Solution, Inc.

-----Original Message-----
From: rancid-discuss-bounces at shrubbery.net [mailto:rancid-discuss-bounces at shrubbery.net] On Behalf Of Gary T. Giesen
Sent: Tuesday, July 21, 2009 4:57 PM
To: Satyam Mathura; rancid-discuss at shrubbery.net
Subject: [rancid] Re: Rancid and Syslog-ng

Another option I use is snmptt. There's an SNMP trap an IOS router can
send upon config change, and I use snmptt to run rancid against that
host when it receives such a trap.

GG

On 6/2/09, Satyam Mathura <satz.sm at gmail.com> wrote:

Guys,
Has anyone ever been successful with setting up rancid and syslog-ng so that
whenever a config change is written to memory, syslog-ng calls the rancid
executable for that host only?
Basically we're looking to have rancid query a device only when that
device's configuration has been modified.


_______________________________________________
Rancid-discuss mailing list
Rancid-discuss at shrubbery.net
http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss


________________________________________

_______________________________________________
Rancid-discuss mailing list
Rancid-discuss at shrubbery.net
http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss



More information about the Rancid-discuss mailing list