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-138-g9af0b6d ([email protected])
   2. [SCM] Netdot branch netdot-1.0 updated.
      netdot-1.0.4-139-g3b5852e ([email protected])
   3. [SCM] Netdot branch master updated.       netdot-1.0.4-139-g3b5852e
      ([email protected])


----------------------------------------------------------------------

Message: 1
Date: Mon, 16 Dec 2013 13:02:23 -0800
From: [email protected]
Subject: [Netdot-devel] [SCM] Netdot branch netdot-1.0 updated.
        netdot-1.0.4-138-g9af0b6d
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  9af0b6d8372f0cff404b0df3ee3d6df4b89f657d (commit)
      from  beebea05d3601ece2445e0864e817ef520fa4d30 (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 9af0b6d8372f0cff404b0df3ee3d6df4b89f657d
Author: Carlos Vicente <[email protected]>
Date:   Fri Dec 13 16:53:39 2013 -0500

    Add 'host_device' field in Device table to represent the relationship of a 
device within a device (e.g. virtual machines), and to reflect that as a 
dependency in monitoring

diff --git a/etc/netdot.meta b/etc/netdot.meta
index 5f1dbe4..5956ba5 100644
--- a/etc/netdot.meta
+++ b/etc/netdot.meta
@@ -2309,6 +2309,19 @@ $meta = {
         tag => 'OS',
         type => 'varchar'
       },
+      host_device => {
+        default => '',
+        description => 'Another device which this one is part of, such as a 
virtual machine host. Host device will be used as parent device in monitoring 
exports.',
+        length => '',
+        linksto => {
+          cascade => 'Delete',
+          method => 'hosted_devices',
+          table => 'Device'
+        },
+        nullable => 1,
+        tag => 'Host Device',
+        type => 'bigint'
+      },
       power_outlet => {
         default => '',
         description => 'ID of the power outlet in a power distribution unit or 
similar',
@@ -2567,6 +2580,7 @@ $meta = {
         'ipforwarding',
         'layers',
         'os',
+        'host_device',
         'extension',
         'bgplocalas',
        'auto_dns',
diff --git a/htdocs/management/device.html b/htdocs/management/device.html
index 97a21d6..642b255 100644
--- a/htdocs/management/device.html
+++ b/htdocs/management/device.html
@@ -354,8 +354,8 @@ my $refresh_url = "device.html?id=$id&view=$view";
 <%perl>
 my (@field_headers, @cell_data);
 
-$ui->add_to_fields(o=>$o, edit=>$editgen, fields=>['name', 'aliases'], 
field_headers=>\@field_headers, 
-                  cell_data=>\@cell_data, linkpages=>['host.html', '']);
+$ui->add_to_fields(o=>$o, edit=>$editgen, fields=>['name', 'aliases', 
'host_device'], field_headers=>\@field_headers, 
+                  cell_data=>\@cell_data, linkpages=>['host.html', '', 
'device.html']);
 
 $ui->add_to_fields(o=>$o, edit=>0, fields=>['sysname', 'sysdescription'], 
field_headers=>\@field_headers, 
                   cell_data=>\@cell_data);
diff --git a/lib/Netdot/Exporter.pm b/lib/Netdot/Exporter.pm
index 6aa041d..06bef0d 100644
--- a/lib/Netdot/Exporter.pm
+++ b/lib/Netdot/Exporter.pm
@@ -83,7 +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, 
+
+          SELECT    d.id, d.snmp_managed, d.community, d.snmp_target, 
d.host_device,
                     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,
@@ -108,7 +109,8 @@ 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,
+
+       my ($devid, $dev_snmp, $community, $target_id, $host_device,
            $mon_template, $down_from, $down_until, $entity_name, 
$entity_alias, 
            $site_name, $site_number, $site_alias, $clid,
            $intid, $intnumber, $intname, $intdesc, $intadmin, $intmon, $intcl,
@@ -118,6 +120,7 @@ sub get_device_info {
        my $hostname = ($name eq '@')? $zone : $name.'.'.$zone;
        $device_info{$devid}{target_id}    = $target_id;
        $device_info{$devid}{hostname}     = $hostname;
+       $device_info{$devid}{host_device}  = $host_device;
        $device_info{$devid}{community}    = $community;
        $device_info{$devid}{snmp_managed} = $dev_snmp;
        $device_info{$devid}{mon_template} = $mon_template;
diff --git a/lib/Netdot/Exporter/Nagios.pm b/lib/Netdot/Exporter/Nagios.pm
index 3743788..7a40f3e 100644
--- a/lib/Netdot/Exporter/Nagios.pm
+++ b/lib/Netdot/Exporter/Nagios.pm
@@ -246,10 +246,14 @@ sub generate_configs {
 
        # Host Parents
        my @parent_names;
-       foreach my $d ( $self->get_monitored_ancestors($devid, $device_parents) 
){
-           my $name = $self->strip_domain($device_info->{$d}->{hostname});
-           push @parent_names, $name;
+       if ( (my @ancestors = $self->get_monitored_ancestors($devid, 
$device_parents)) ){
+           foreach my $d ( @ancestors ){
+               push @parent_names, 
$self->strip_domain($device_info->{$d}->{hostname});
+           }
+       }elsif ( (my $hd = $devh->{host_device}) ){
+           push @parent_names, 
$self->strip_domain($device_info->{$hd}->{hostname});
        }
+
        
        # Services monitored via SNMP on the target IP
        if ( $devh->{snmp_managed} ){
diff --git a/lib/Netdot/Model/Device.pm b/lib/Netdot/Model/Device.pm
index 5db2d91..465a781 100644
--- a/lib/Netdot/Model/Device.pm
+++ b/lib/Netdot/Model/Device.pm
@@ -2553,7 +2553,8 @@ sub is_in_downtime {
     We override the update method for extra functionality:
       - Update 'last_updated' field with current timestamp
       - snmp_managed flag turns off all other snmp access flags
-
+      - Validate various arguments
+    
   Arguments:
     Hash ref with Device fields
   Returns:
@@ -3868,6 +3869,14 @@ sub _validate_args {
            }
        }
     }
+
+    # Host Device
+    if ( $self && $args->{host_device} ){
+       my $hd = scalar($args->{host_device});
+       if ( $hd == $self->id ){
+           $class->throw_user("Device cannot be a host of itself");
+       }
+    }
     
     return 1;
 }
diff --git a/upgrade/updatedb b/upgrade/updatedb
index fa00557..0f3ef2d 100644
--- a/upgrade/updatedb
+++ b/upgrade/updatedb
@@ -224,6 +224,11 @@ sub upg_104_105 {
 
        push @statements, "ALTER TABLE device ADD COLUMN monitoring_template 
varchar(255);";
 
+       push @statements, "ALTER TABLE device ADD COLUMN host_device bigint;";
+       push @statements, "ALTER TABLE device ADD CONSTRAINT `fk_host_device` 
FOREIGN KEY (`host_device`) ".
+           "REFERENCES `device` (`id`);";
+       push @statements, "CREATE INDEX host_device ON device (host_device)";
+
        push @statements, "DROP TABLE backbonecable_history;";
        push @statements, "DROP TABLE cablestrand_history;";
        push @statements, "DROP TABLE circuit_history;";
@@ -283,6 +288,10 @@ sub upg_104_105 {
 
        push @statements, "ALTER TABLE device ADD COLUMN monitoring_template 
character varying(255);";
 
+       push @statements, "ALTER TABLE device ADD COLUMN host_device TYPE 
bigint;";
+       push @statements, "ALTER TABLE device ADD CONSTRAINT \"fk_host_device\" 
FOREIGN KEY (\"host_device\") ".
+           "REFERENCES \"device\" (\"id\") DEFERRABLE;";
+
        push @statements, "DROP TABLE backbonecable_history;";
        push @statements, "DROP TABLE cablestrand_history;";
        push @statements, "DROP TABLE circuit_history;";

-----------------------------------------------------------------------

Summary of changes:
 etc/netdot.meta               |   14 ++++++++++++++
 htdocs/management/device.html |    4 ++--
 lib/Netdot/Exporter.pm        |    7 +++++--
 lib/Netdot/Exporter/Nagios.pm |   10 +++++++---
 lib/Netdot/Model/Device.pm    |   11 ++++++++++-
 upgrade/updatedb              |    9 +++++++++
 6 files changed, 47 insertions(+), 8 deletions(-)


hooks/post-receive
-- 
Netdot


------------------------------

Message: 2
Date: Tue, 17 Dec 2013 11:52:49 -0800
From: [email protected]
Subject: [Netdot-devel] [SCM] Netdot branch netdot-1.0 updated.
        netdot-1.0.4-139-g3b5852e
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  3b5852e316e060e18783d7f636860eb33721cde6 (commit)
      from  9af0b6d8372f0cff404b0df3ee3d6df4b89f657d (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 3b5852e316e060e18783d7f636860eb33721cde6
Author: Carlos Vicente <[email protected]>
Date:   Tue Dec 17 14:52:34 2013 -0500

    Added tab to show hosted devices in device page

diff --git a/htdocs/management/device.html b/htdocs/management/device.html
index 642b255..4001c6b 100644
--- a/htdocs/management/device.html
+++ b/htdocs/management/device.html
@@ -264,6 +264,14 @@ my $refresh_url = "device.html?id=$id&view=$view";
           <li><a href="device.html?id=<% $id %>&view=BGP">BGP Peers</a></li>
 %       }
 %     }
+%     my @hosted = $o->hosted_devices;
+%     if ( @hosted ){
+%       if( $view eq "Hosted" ) {
+          <li><span>Hosted</span></li>
+%       } else {
+          <li><a href="device.html?id=<% $id %>&view=Hosted">Hosted</a></li>
+%       }
+%     }
 %     my @circuits = $o->get_circuits;
 %     if( scalar @circuits ){
 %         if( $view eq "Circuit" ){
@@ -1573,12 +1581,14 @@ if ( $ipeers ){
 %
 %
 <!-- End Audit Section -->
+
 %#######################################################################
 %#
 %# Circuit
 %#
 %#######################################################################
 
+<!-- Circuits -->
 %if ( $view eq "Circuit" || $view eq "All" ){
     <div class="container">
         <div class="containerhead">Circuits</div>
@@ -1587,6 +1597,24 @@ if ( $ipeers ){
         </div>
     </div>
 %}
+<!-- End Circuits Section -->
+
+%#######################################################################
+%#
+%# Hosted Devices
+%#
+%#######################################################################
+
+<!-- Hosted Devices -->
+%if ( $view eq "Hosted" || $view eq "All" ){
+    <div class="container">
+        <div class="containerhead">Hosted Devices</div>
+        <div class="containerbody">
+            <& /generic/sortresults.mhtml, object => \@hosted , view => "row" 
&>
+        </div>
+    </div>
+%}
+<!-- End Hosted Devices Section -->
 
 
 %################################################################

-----------------------------------------------------------------------

Summary of changes:
 htdocs/management/device.html |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)


hooks/post-receive
-- 
Netdot


------------------------------

Message: 3
Date: Tue, 17 Dec 2013 11:53:37 -0800
From: [email protected]
Subject: [Netdot-devel] [SCM] Netdot branch master updated.
        netdot-1.0.4-139-g3b5852e
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  3b5852e316e060e18783d7f636860eb33721cde6 (commit)
       via  9af0b6d8372f0cff404b0df3ee3d6df4b89f657d (commit)
       via  beebea05d3601ece2445e0864e817ef520fa4d30 (commit)
      from  bf727fe9d79554bb66bf0869067f8afe617a510c (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/netdot.meta               |   14 ++++++++++++++
 htdocs/management/device.html |   32 ++++++++++++++++++++++++++++++--
 htdocs/management/ip.html     |    2 +-
 lib/Netdot/Exporter.pm        |    7 +++++--
 lib/Netdot/Exporter/Nagios.pm |   10 +++++++---
 lib/Netdot/Model/Device.pm    |   11 ++++++++++-
 upgrade/updatedb              |    9 +++++++++
 7 files changed, 76 insertions(+), 9 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 81, Issue 6
*******************************************

Reply via email to