Send Netdot-devel mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
https://osl.uoregon.edu/mailman/listinfo/netdot-devel
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Netdot-devel digest..."
Today's Topics:
1. [SCM] Netdot branch netdot-1.0 updated.
netdot-1.0.4-105-gecd83f7 ([email protected])
2. [SCM] Netdot branch master updated. netdot-1.0.4-105-gecd83f7
([email protected])
----------------------------------------------------------------------
Message: 1
Date: Thu, 10 Oct 2013 15:20:59 -0700
From: [email protected]
Subject: [Netdot-devel] [SCM] Netdot branch netdot-1.0 updated.
netdot-1.0.4-105-gecd83f7
To: [email protected]
Message-ID: <[email protected]>
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Netdot".
The branch, netdot-1.0 has been updated
via ecd83f7671551ea2b92be3d51c3e5bca60b506dc (commit)
via 34486c110bd9e4eb098c66fb994001cb74312bbb (commit)
via 7e751720bb121ee2e281de1da54da22cc0202d43 (commit)
via b050b9ac7456fb0a89bf9cbb0a558d5583333699 (commit)
from 42b2bdb98fdf53e3249324ea07bc53bc8260eb51 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit ecd83f7671551ea2b92be3d51c3e5bca60b506dc
Author: Carlos Vicente <[email protected]>
Date: Fri Oct 4 05:33:06 2013 -0400
Correction to earlier change to make RIR a selection instead of a free-form
input text field
diff --git a/etc/Default.conf b/etc/Default.conf
index 36f75cc..37b8fa1 100644
--- a/etc/Default.conf
+++ b/etc/Default.conf
@@ -593,9 +593,15 @@ IP_TREE_TTL => '86400',
SUBNET_BLOCK_VIEW_MAX_PREFIX => 19,
CONTAINER_BLOCK_VIEW_MAX_PREFIX => 16,
-# Validate RIR input from user
-# Configured value will be evaluated as a regular expression
-VALID_RIR_REGEX => '^AFRINIC$|^APNIC$|^ARIN$|^LACNIC$|^RIPE$|^IANA$',
+# List of RIRs
+VALID_RIRS => {
+ 'AFRINIC' => 'AFRINIC',
+ 'APNIC' => 'APNIC',
+ 'ARIN' => 'ARIN',
+ 'LACNIC' => 'LACNIC',
+ 'RIPE' => 'RIPE',
+ 'IANA' => 'IANA',
+},
#####################################################################
# Topology Discovery
diff --git a/htdocs/management/ip.html b/htdocs/management/ip.html
index b9e1538..13043be 100644
--- a/htdocs/management/ip.html
+++ b/htdocs/management/ip.html
@@ -1285,9 +1285,15 @@ if ( $o->status->name eq 'Subnet' ){
################
# RIR and ASN
if ( $o->status->name eq 'Container' ){
- $ui->add_to_fields(o=>$o, edit=>$edit_block, fields=>['rir','asn'],
- field_headers=>\@field_headers, cell_data=>\@cell_data,
linkpages=>['','view.html']);
+
+ my $defaults = Netdot->config->get('VALID_RIRS');
+ $ui->add_to_fields(o=>$o, edit=>$edit_block, fields=>['rir'],
+ field_headers=>\@field_headers, cell_data=>\@cell_data,
defaults=>[$defaults]);
+
+ $ui->add_to_fields(o=>$o, edit=>$edit_block, fields=>['asn'],
+ field_headers=>\@field_headers, cell_data=>\@cell_data,
linkpages=>['view.html']);
}
+
################
# Owner
# For some fields, we will provide a way to update the values recursively in
all
diff --git a/lib/Netdot/Model/Ipblock.pm b/lib/Netdot/Model/Ipblock.pm
index a54dc38..f2c21d2 100644
--- a/lib/Netdot/Model/Ipblock.pm
+++ b/lib/Netdot/Model/Ipblock.pm
@@ -3082,8 +3082,8 @@ sub _validate {
}
if ( my $rir = $args->{rir} ){
- my $re = $self->config->get('VALID_RIR_REGEX');
- unless ( $rir =~ /$re/ ){
+ my $valid_rirs = $self->config->get('VALID_RIRS');
+ unless ( exists $valid_rirs->{$rir} ){
$self->throw_user("Invalid RIR: $rir");
}
}
diff --git a/lib/Netdot/UI.pm b/lib/Netdot/UI.pm
index 4303206..eeabf31 100644
--- a/lib/Netdot/UI.pm
+++ b/lib/Netdot/UI.pm
@@ -939,6 +939,7 @@ sub text_field($@){
if ( $defaults && ref($defaults) eq "HASH" ){
# Show a select tag instead
$output .= "<select name=\"$name\">";
+ $output .= '<option value=""></option>';
my $value_found = 0;
foreach my $key ( sort { $defaults->{$a} cmp $defaults->{$b} }
keys %$defaults ){
@@ -950,7 +951,7 @@ sub text_field($@){
$output .= "<option value=\"$key\">$v</option>";
}
}
- unless ( $value_found ){
+ if ( !$value_found && $value ne "" ){
$output .= "<option value=\"$value\" SELECTED>$value</option>";
}
$output .= '</select>';
commit 34486c110bd9e4eb098c66fb994001cb74312bbb
Author: Carlos Vicente <[email protected]>
Date: Fri Oct 4 05:09:32 2013 -0400
Use a select tag for assigning device monitoring templates
diff --git a/etc/Default.conf b/etc/Default.conf
index 652f478..36f75cc 100644
--- a/etc/Default.conf
+++ b/etc/Default.conf
@@ -375,6 +375,16 @@ DEFAULT_DEV_MONITORED => {
'Wireless Controller' => 1,
},
+# Host templates to be assigned to particular devices in the web UI.
+# For example, if using Nagios, these will be in the "use" statement, and
+# must be defined in hosts.include.
+# This list is used to generate the drop-down menu for "Monitoring Template"
+# in the device page.
+DEV_MONITORING_TEMPLATES => {
+ 'my_template_1' => 'my_template_1',
+ 'my_template_2' => 'my_template_2',
+},
+
# Whether Devices configurations should be monitored
# by default. Config monitoring is done by third-party
# software such as RANCID. Netdot can only export
@@ -794,7 +804,7 @@ NAGIOS_TEMPLATES => {
generic_service => 'generic-service',
generic_ping => 'generic-ping',
generic_trap => 'generic-trap',
- generic_contact => 'generic-contact',
+ generic_contact => 'generic-contact',
},
# Map Netdot's service names to Nagios' plugin names
diff --git a/htdocs/management/device.html b/htdocs/management/device.html
index 24dc8f5..1028ea4 100644
--- a/htdocs/management/device.html
+++ b/htdocs/management/device.html
@@ -513,10 +513,23 @@ $ui->add_to_fields(o=>$o, edit=>0, fields=>\@fields,
field_headers=>\@field_head
$ui->add_to_fields(o=>$o, edit=>0, fields=>['date_installed', 'last_updated'],
field_headers=>\@field_headers, cell_data=>\@cell_data);
{
- my @fields = ('oobname', 'oobname_2', 'oobnumber', 'oobnumber_2',
'power_outlet', 'power_outlet_2',
- 'monitored', 'monitoring_template', 'monitoring_path_cost',
'customer_managed',
- 'monitor_config', 'monitor_config_group', 'down_from',
'down_until',
- 'snmp_managed', 'auto_dns');
+ my @fields = ('oobname', 'oobname_2', 'oobnumber', 'oobnumber_2',
'power_outlet', 'power_outlet_2', 'monitored');
+ $ui->add_to_fields(o=>$o, edit=>$editmgmt, fields=>\@fields,
field_headers=>\@field_headers, cell_data=>\@cell_data);
+
+ if ( $o->monitored ){
+ my %tmp;
+ if ( $editmgmt ){
+ my $templates = Netdot->config->get('DEV_MONITORING_TEMPLATES');
+ %tmp = $ui->form_field(object=>$o, column=>"monitoring_template",
defaults=>$templates, edit=>$editmgmt);
+ }else{
+ %tmp = $ui->form_field(object=>$o, column=>"monitoring_template",
edit=>$editmgmt);
+ }
+ push( @field_headers, $tmp{label} );
+ push( @cell_data, $tmp{value} );
+ }
+
+ @fields = ('monitoring_path_cost', 'customer_managed', 'monitor_config',
'monitor_config_group',
+ 'down_from', 'down_until', 'snmp_managed', 'auto_dns');
$ui->add_to_fields(o=>$o, edit=>$editmgmt, fields=>\@fields,
field_headers=>\@field_headers, cell_data=>\@cell_data);
push( @field_headers, $ui->col_descr_link('Device', 'layers', 'Layers:') );
commit 7e751720bb121ee2e281de1da54da22cc0202d43
Author: Carlos Vicente <[email protected]>
Date: Fri Oct 4 04:30:44 2013 -0400
Added new device field to specify different monitoring templates (e.g. for
Nagios)
diff --git a/etc/netdot.meta b/etc/netdot.meta
index 2739172..5ffdb6f 100644
--- a/etc/netdot.meta
+++ b/etc/netdot.meta
@@ -2222,6 +2222,14 @@ $meta = {
tag => 'Path Cost',
type => 'integer'
},
+ monitoring_template => {
+ default => '',
+ description => 'A template that defines common monitoring parameters
for a group of devices. (E.g. a Nagios template to inherit from)',
+ length => '255',
+ nullable => 1,
+ tag => 'Monitoring Template',
+ type => 'varchar'
+ },
monitorstatus => {
default => '',
description => 'The monitoring status of this Device. This values is
supposed to be fed back into Netdot by an external process',
@@ -2573,6 +2581,7 @@ $meta = {
'used_by',
'monitored',
'monitoring_path_cost',
+ 'monitoring_template',
'monitorstatus',
'customer_managed',
'community',
diff --git a/htdocs/management/device.html b/htdocs/management/device.html
index 83fce20..24dc8f5 100644
--- a/htdocs/management/device.html
+++ b/htdocs/management/device.html
@@ -514,7 +514,7 @@ $ui->add_to_fields(o=>$o, edit=>0,
fields=>['date_installed', 'last_updated'], f
{
my @fields = ('oobname', 'oobname_2', 'oobnumber', 'oobnumber_2',
'power_outlet', 'power_outlet_2',
- 'monitored', 'monitoring_path_cost', 'customer_managed',
+ 'monitored', 'monitoring_template', 'monitoring_path_cost',
'customer_managed',
'monitor_config', 'monitor_config_group', 'down_from',
'down_until',
'snmp_managed', 'auto_dns');
$ui->add_to_fields(o=>$o, edit=>$editmgmt, fields=>\@fields,
field_headers=>\@field_headers, cell_data=>\@cell_data);
diff --git a/lib/Netdot/Exporter.pm b/lib/Netdot/Exporter.pm
index 3fecfa2..6aa041d 100644
--- a/lib/Netdot/Exporter.pm
+++ b/lib/Netdot/Exporter.pm
@@ -83,8 +83,8 @@ sub get_device_info {
my %device_info;
$logger->debug("Netdot::Exporter::get_device_info: querying database");
my $rows = $self->{_dbh}->selectall_arrayref("
- SELECT d.id, d.snmp_managed, d.community, d.snmp_target,
- d.down_from, d.down_until, entity.name, entity.aliases,
+ SELECT d.id, d.snmp_managed, d.community, d.snmp_target,
+ d.monitoring_template, d.down_from, d.down_until,
entity.name, entity.aliases,
site.name, site.number, site.aliases, contactlist.id,
i.id, i.number, i.name, i.description, i.admin_status,
i.monitored, i.contactlist,
ip.id, ip.address, ip.version, ip.parent, ip.monitored,
rr.name, zone.name,
@@ -109,7 +109,7 @@ sub get_device_info {
$logger->debug("Netdot::Exporter::get_device_info: building data
structure");
foreach my $row ( @$rows ){
my ($devid, $dev_snmp, $community, $target_id,
- $down_from, $down_until, $entity_name, $entity_alias,
+ $mon_template, $down_from, $down_until, $entity_name,
$entity_alias,
$site_name, $site_number, $site_alias, $clid,
$intid, $intnumber, $intname, $intdesc, $intadmin, $intmon, $intcl,
$ip_id, $ip_addr, $ip_version, $subnet, $ip_mon, $name, $zone,
@@ -120,6 +120,7 @@ sub get_device_info {
$device_info{$devid}{hostname} = $hostname;
$device_info{$devid}{community} = $community;
$device_info{$devid}{snmp_managed} = $dev_snmp;
+ $device_info{$devid}{mon_template} = $mon_template;
$device_info{$devid}{down_from} = $down_from;
$device_info{$devid}{down_until} = $down_until;
$device_info{$devid}{usedby_entity_name} = $entity_name if defined
$entity_name;
diff --git a/lib/Netdot/Exporter/Nagios.pm b/lib/Netdot/Exporter/Nagios.pm
index 9ff71e3..3743788 100644
--- a/lib/Netdot/Exporter/Nagios.pm
+++ b/lib/Netdot/Exporter/Nagios.pm
@@ -195,6 +195,9 @@ sub generate_configs {
$hosts{$ip}{name} ||= $ip;
$hostnames{$hosts{$ip}{name}} = 1;
+ # Template
+ $hosts{$ip}{use_host} = $devh->{mon_template} if defined
$devh->{mon_template};
+
# Determine the hostgroup name and alias
my $group_name;
my $group_alias;
@@ -438,6 +441,7 @@ sub print_host {
my $ip = $argv->{ip};
my $group = $argv->{group};
my $parents = $argv->{parents};
+ my $use_host = $argv->{use_host};
my @cls = @{ $argv->{contactlists} } if $argv->{contactlists};
my $out = $self->{out};
@@ -445,6 +449,9 @@ sub print_host {
my $generic_trap = $self->{NAGIOS_TEMPLATES}->{generic_trap};
my $generic_ping = $self->{NAGIOS_TEMPLATES}->{generic_ping};
+ # Use the generic template if not passed to us
+ $use_host ||= $generic_host;
+
my $contactlists = $self->{contactlists};
my %levels;
if ( @cls ) {
@@ -474,7 +481,7 @@ sub print_host {
if ( $first ){
print $out "define host{\n";
- print $out "\tuse $generic_host\n";
+ print $out "\tuse $use_host\n";
print $out "\thost_name $name\n";
print $out "\talias $alias\n";
print $out "\taddress $ip\n";
@@ -517,7 +524,7 @@ sub print_host {
}
if ( !@cls || !keys %levels ){
print $out "define host{\n";
- print $out "\tuse $generic_host\n";
+ print $out "\tuse $use_host\n";
print $out "\thost_name $name\n";
print $out "\talias $alias\n";
print $out "\taddress $ip\n";
diff --git a/upgrade/updatedb b/upgrade/updatedb
index 249f60a..d41f021 100644
--- a/upgrade/updatedb
+++ b/upgrade/updatedb
@@ -227,6 +227,8 @@ sub upg_104_105 {
push @statements, "CREATE UNIQUE INDEX rrds1 ON rrds (rr, key_tag,
algorithm, digest_type);";
push @statements, "ALTER TABLE rrds ADD CONSTRAINT `fk_rr_2` FOREIGN
KEY (`rr`) REFERENCES `rr` (`id`);";
+ push @statements, "ALTER TABLE device ADD COLUMN monitoring_template
varchar(255);";
+
}elsif ( $dbms eq 'Pg' ){
push @statements, "ALTER TABLE device ADD COLUMN oobname_2 character
varying(255);";
@@ -276,6 +278,7 @@ sub upg_104_105 {
push @statements, 'DROP CONSTRAINT "rrds1";';
push @statements, 'ALTER TABLE bgppeering ADD CONSTRAINT "rrds1" UNIQUE
("rr", "key_tag", "algorithm", "digest_type");';
+ push @statements, "ALTER TABLE device ADD COLUMN monitoring_template
character varying(255);";
}
push @statements, "UPDATE schemainfo SET version='1.0.5' WHERE id=1;";
commit b050b9ac7456fb0a89bf9cbb0a558d5583333699
Author: Carlos Vicente <[email protected]>
Date: Fri Oct 4 04:12:39 2013 -0400
Correct constraint name from earlier changes
diff --git a/upgrade/updatedb b/upgrade/updatedb
index f3f0636..249f60a 100644
--- a/upgrade/updatedb
+++ b/upgrade/updatedb
@@ -198,7 +198,7 @@ sub upg_104_105 {
";
push @statements, "ALTER TABLE ipblock ADD COLUMN asn bigint;";
- push @statements, "ALTER TABLE ipblock ADD CONSTRAINT `fk_asn_ipblock`
FOREIGN KEY (`asn`) ".
+ push @statements, "ALTER TABLE ipblock ADD CONSTRAINT `fk_asn` FOREIGN
KEY (`asn`) ".
"REFERENCES `asn` (`id`);";
push @statements, "CREATE INDEX asn ON ipblock (asn)";
-----------------------------------------------------------------------
Summary of changes:
etc/Default.conf | 24 ++++++++++++++++++++----
etc/netdot.meta | 9 +++++++++
htdocs/management/device.html | 21 +++++++++++++++++----
htdocs/management/ip.html | 10 ++++++++--
lib/Netdot/Exporter.pm | 7 ++++---
lib/Netdot/Exporter/Nagios.pm | 11 +++++++++--
lib/Netdot/Model/Ipblock.pm | 4 ++--
lib/Netdot/UI.pm | 3 ++-
upgrade/updatedb | 5 ++++-
9 files changed, 75 insertions(+), 19 deletions(-)
hooks/post-receive
--
Netdot
------------------------------
Message: 2
Date: Thu, 10 Oct 2013 15:21:51 -0700
From: [email protected]
Subject: [Netdot-devel] [SCM] Netdot branch master updated.
netdot-1.0.4-105-gecd83f7
To: [email protected]
Message-ID: <[email protected]>
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Netdot".
The branch, master has been updated
via ecd83f7671551ea2b92be3d51c3e5bca60b506dc (commit)
via 34486c110bd9e4eb098c66fb994001cb74312bbb (commit)
via 7e751720bb121ee2e281de1da54da22cc0202d43 (commit)
via b050b9ac7456fb0a89bf9cbb0a558d5583333699 (commit)
from 42b2bdb98fdf53e3249324ea07bc53bc8260eb51 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
-----------------------------------------------------------------------
Summary of changes:
etc/Default.conf | 24 ++++++++++++++++++++----
etc/netdot.meta | 9 +++++++++
htdocs/management/device.html | 21 +++++++++++++++++----
htdocs/management/ip.html | 10 ++++++++--
lib/Netdot/Exporter.pm | 7 ++++---
lib/Netdot/Exporter/Nagios.pm | 11 +++++++++--
lib/Netdot/Model/Ipblock.pm | 4 ++--
lib/Netdot/UI.pm | 3 ++-
upgrade/updatedb | 5 ++++-
9 files changed, 75 insertions(+), 19 deletions(-)
hooks/post-receive
--
Netdot
------------------------------
_______________________________________________
Netdot-devel mailing list
[email protected]
https://osl.uoregon.edu/mailman/listinfo/netdot-devel
End of Netdot-devel Digest, Vol 79, Issue 7
*******************************************