fix rancid, graph, and nodemonitor
This commit is contained in:
@@ -46,7 +46,7 @@ use App::Netdisco::Util::Permission ':all';
|
||||
exit(0) unless setting('use_legacy_rancidexport');
|
||||
|
||||
my $settings = setting( 'rancid' );
|
||||
my $domain_suffix = setting( 'domain_suffix' ) || '';
|
||||
my $domain_suffix = setting( 'domain_suffix' );
|
||||
my $delimiter = $settings->{ 'delimiter' } || ':';
|
||||
my $down_age = $settings->{ 'down_age' } || '1 day';
|
||||
my $rancidhome = $settings->{ 'rancid_home' } || '/var/lib/rancid';
|
||||
@@ -110,7 +110,7 @@ foreach my $group (keys %$list) {
|
||||
$name = ($dev->dns || $dev->name);
|
||||
}
|
||||
if ($by_hostname->{$group}) {
|
||||
$name =~ s/$domain_suffix$//;
|
||||
$name =~ s/$domain_suffix//;
|
||||
}
|
||||
printf ROUTER "%s$delimiter%s$delimiter%s\n", $name, $vendor,
|
||||
$dev->get_column( 'old' ) ? "down" : "up";
|
||||
|
||||
@@ -298,8 +298,8 @@ sub graph_addnode {
|
||||
$devloc = $GRAPH{$ip}->{location};
|
||||
|
||||
$label = "($ip)" unless defined $label;
|
||||
my $domain_suffix = setting('domain_suffix') || '';
|
||||
$label =~ s/$domain_suffix$//;
|
||||
my $domain_suffix = setting('domain_suffix');
|
||||
$label =~ s/$domain_suffix//;
|
||||
$node{label} = $label;
|
||||
|
||||
# Dereferencing the scalar by name below
|
||||
|
||||
@@ -5,6 +5,7 @@ use App::Netdisco;
|
||||
use Dancer qw/:syntax :script/;
|
||||
use Dancer::Plugin::DBIC 'schema';
|
||||
|
||||
use Net::Domain 'hostfqdn';
|
||||
use App::Netdisco::Util::DNS qw/hostname_from_ip ipv4_from_hostname/;
|
||||
|
||||
use base 'Exporter';
|
||||
@@ -16,8 +17,7 @@ our %EXPORT_TAGS = (all => \@EXPORT_OK);
|
||||
sub _email {
|
||||
my ($to, $subject, $body) = @_;
|
||||
return unless $to;
|
||||
my $domain = setting('domain_suffix') || 'localhost';
|
||||
$domain =~ s/^\.//;
|
||||
$domain =~ (hostfqdn || 'fqdn-undefined');
|
||||
|
||||
my $SENDMAIL = '/usr/sbin/sendmail';
|
||||
open (SENDMAIL, "| $SENDMAIL -t") or die "Can't open sendmail at $SENDMAIL.\n";
|
||||
|
||||
@@ -18,7 +18,7 @@ register_worker({ phase => 'main' }, sub {
|
||||
my ($job, $workerconf) = @_;
|
||||
my $config = setting('rancid') || {};
|
||||
|
||||
my $domain_suffix = setting('domain_suffix') || '';
|
||||
my $domain_suffix = setting('domain_suffix');
|
||||
my $delimiter = $config->{delimiter} || ';';
|
||||
my $down_age = $config->{down_age} || '1 day';
|
||||
my $default_group = $config->{default_group} || 'default';
|
||||
@@ -65,7 +65,7 @@ register_worker({ phase => 'main' }, sub {
|
||||
}
|
||||
|
||||
my $name = check_acl_no($d, $config->{by_ip}) ? $d->ip : ($d->dns || $d->name);
|
||||
$name =~ s/$domain_suffix$// if check_acl_no($d, $config->{by_hostname});
|
||||
$name =~ s/$domain_suffix// if check_acl_no($d, $config->{by_hostname});
|
||||
|
||||
my ($group) =
|
||||
(pairkeys pairfirst { check_acl_no($d, $b) } %{ $config->{groups} }) || $default_group;
|
||||
|
||||
Reference in New Issue
Block a user