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. Exporter.pm Pg compat patch (Karl Putland)
2. Re: Exporter.pm Pg compat patch (Carlos Vicente)
3. Re: Exporter.pm Pg compat patch (Karl Putland)
----------------------------------------------------------------------
Message: 1
Date: Wed, 12 Sep 2012 15:43:43 -0600
From: Karl Putland <[email protected]>
Subject: [Netdot-devel] Exporter.pm Pg compat patch
To: [email protected]
Message-ID:
<CA+EXWsxaELdqZVVCsfFhQO8HDV+4Ho-=qojfrs6zgirec-7...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
--- Netdot.orig/Exporter.pm 2012-08-22 20:22:42.175837081 +0000
+++ Netdot/Exporter.pm 2012-09-11 17:35:15.191837116 +0000
@@ -58,6 +58,7 @@
}
$self->{_dbh} = Netdot::Model->db_Main();
+ $self->{_db_type} = Netdot::Model->config->get('DB_TYPE');
return $self;
}
@@ -73,28 +74,49 @@
=cut
sub get_device_info {
my ($self) = @_;
+ my $rows;
return $self->cache('exporter_device_info') if
$self->cache('exporter_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.down_from, d.down_until, entity.name,
contactlist.id,
- target.id, target.address, target.version,
target.parent, rr.name, zone.name,
- i.id, i.number, i.admin_status, i.monitored,
i.contactlist,
- bgppeering.bgppeeraddr, bgppeering.monitored
- FROM rr, zone, interface i, device d
- LEFT JOIN ipblock target ON d.snmp_target=target.id
- LEFT JOIN entity ON d.used_by=entity.id
- LEFT JOIN devicecontacts ON d.id=devicecontacts.device
- LEFT JOIN contactlist ON contactlist.id
=devicecontacts.contactlist
- LEFT JOIN bgppeering ON d.id=bgppeering.device
- WHERE d.monitored=1
- AND i.device=d.id
- AND d.name=rr.id
- AND rr.zone=zone.id
- ");
+ if ($self->{_db_type} eq "mysql") {
+ my $rows = $self->{_dbh}->selectall_arrayref("
+ SELECT d.id, d.snmp_managed, d.community,
+ d.down_from, d.down_until, entity.name, contactlist.id,
+ target.id, target.address, target.version, target.parent, rr.name,
zone.name,
+ i.id, i.number, i.admin_status, i.monitored, i.contactlist,
+ bgppeering.bgppeeraddr, bgppeering.monitored
+ FROM rr, zone, interface i, device d
+ LEFT JOIN ipblock target ON d.snmp_target=target.id
+ LEFT JOIN entity ON d.used_by=entity.id
+ LEFT JOIN devicecontacts ON d.id=devicecontacts.device
+ LEFT JOIN contactlist ON contactlist.id=devicecontacts.contactlist
+ LEFT JOIN bgppeering ON d.id=bgppeering.device
+ WHERE d.monitored=1
+ AND i.device=d.id
+ AND d.name=rr.id
+ AND rr.zone=zone.id
+ ");
+ } elsif($self->{db_type} eq "Pg") {
+ my $rows = $self->{_dbh}->selectall_arrayref("
+ SELECT d.id, d.snmp_managed, d.community,
+ d.down_from, d.down_until, entity.name, contactlist.id,
+ target.id, target.address, target.version, target.parent, rr.name,
zone.name,
+ i.id, i.number, i.admin_status, i.monitored, i.contactlist,
+ bgppeering.bgppeeraddr, bgppeering.monitored
+ FROM rr, zone, interface i, device d
+ LEFT JOIN ipblock target ON d.snmp_target=target.id
+ LEFT JOIN entity ON d.used_by=entity.id
+ LEFT JOIN devicecontacts ON d.id=devicecontacts.device
+ LEFT JOIN contactlist ON contactlist.id=devicecontacts.contactlist
+ LEFT JOIN bgppeering ON d.id=bgppeering.device
+ WHERE d.monitored='true'
+ AND i.device=d.id
+ AND d.name=rr.id
+ AND rr.zone=zone.id
+ ");
+ }
$logger->debug("Netdot::Exporter::get_device_info: building data
structure");
foreach my $row ( @$rows ){
--Karl
Karl Putland
Senior VoIP Engineer
*SimpleSignal*
3600 S Yosemite, Suite 150
Denver, CO 80237
One Number Rings All My Phones: 303-242-8608
SimpleSignal.com <http://www.simplesignal.com/> |
Blog<http://www.simplesignal.com/blog>
| Facebook <http://www.facebook.com/SimpleSignal?ref=ts> |
Twitter<http://twitter.com/simplesignal>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://osl.uoregon.edu/pipermail/netdot-devel/attachments/20120912/6a25d06f/attachment-0001.html
------------------------------
Message: 2
Date: Wed, 12 Sep 2012 18:05:55 -0400
From: Carlos Vicente <[email protected]>
Subject: Re: [Netdot-devel] Exporter.pm Pg compat patch
To: Karl Putland <[email protected]>
Cc: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1
Karl,
It would be useful if you explain what the patch is about.
Thanks,
cv
On 9/12/12 5:43 PM, Karl Putland wrote:
> --- Netdot.orig/Exporter.pm2012-08-22 20:22:42.175837081 +0000
> +++ Netdot/Exporter.pm2012-09-11 17:35:15.191837116 +0000
> @@ -58,6 +58,7 @@
> }
>
> $self->{_dbh} = Netdot::Model->db_Main();
> + $self->{_db_type} = Netdot::Model->config->get('DB_TYPE');
> return $self;
> }
>
> @@ -73,28 +74,49 @@
> =cut
> sub get_device_info {
> my ($self) = @_;
> + my $rows;
>
> return $self->cache('exporter_device_info')if
> $self->cache('exporter_device_info');
>
> my %device_info;
> $logger->debug("Netdot::Exporter::get_device_info: querying database");
> - my $rows = $self->{_dbh}->selectall_arrayref("
> - SELECT d.id <http://d.id>, d.snmp_managed, d.community,
> - d.down_from, d.down_until, entity.name
> <http://entity.name>, contactlist.id <http://contactlist.id>,
> - target.id <http://target.id>, target.address,
> target.version, target.parent, rr.name <http://rr.name>, zone.name
> <http://zone.name>,
> - i.id <http://i.id>, i.number, i.admin_status,
> i.monitored, i.contactlist,
> - bgppeering.bgppeeraddr, bgppeering.monitored
> - FROM rr, zone, interface i, device d
> - LEFT JOIN ipblock target ON d.snmp_target=target.id
> <http://target.id>
> - LEFT JOIN entity ON d.used_by=entity.id <http://entity.id>
> - LEFT JOIN devicecontacts ON d.id
> <http://d.id>=devicecontacts.device
> - LEFT JOIN contactlist ON contactlist.id
> <http://contactlist.id>=devicecontacts.contactlist
> - LEFT JOIN bgppeering ON d.id
> <http://d.id>=bgppeering.device
> - WHERE d.monitored=1
> - AND i.device=d.id <http://d.id>
> - AND d.name <http://d.name>=rr.id <http://rr.id>
> - AND rr.zone=zone.id <http://zone.id>
> - ");
> + if ($self->{_db_type} eq "mysql") {
> +my $rows = $self->{_dbh}->selectall_arrayref("
> + SELECT d.id <http://d.id>, d.snmp_managed, d.community,
> + d.down_from, d.down_until, entity.name <http://entity.name>,
> contactlist.id <http://contactlist.id>,
> + target.id <http://target.id>, target.address, target.version,
> target.parent, rr.name <http://rr.name>, zone.name <http://zone.name>,
> + i.id <http://i.id>, i.number, i.admin_status, i.monitored,
> i.contactlist,
> + bgppeering.bgppeeraddr, bgppeering.monitored
> + FROM rr, zone, interface i, device d
> + LEFT JOIN ipblock target ON d.snmp_target=target.id <http://target.id>
> + LEFT JOIN entity ON d.used_by=entity.id <http://entity.id>
> + LEFT JOIN devicecontacts ON d.id <http://d.id>=devicecontacts.device
> + LEFT JOIN contactlist ON contactlist.id
> <http://contactlist.id>=devicecontacts.contactlist
> + LEFT JOIN bgppeering ON d.id <http://d.id>=bgppeering.device
> + WHERE d.monitored=1
> +AND i.device=d.id <http://d.id>
> +AND d.name <http://d.name>=rr.id <http://rr.id>
> +AND rr.zone=zone.id <http://zone.id>
> + ");
> + } elsif($self->{db_type} eq "Pg") {
> +my $rows = $self->{_dbh}->selectall_arrayref("
> + SELECT d.id <http://d.id>, d.snmp_managed, d.community,
> + d.down_from, d.down_until, entity.name <http://entity.name>,
> contactlist.id <http://contactlist.id>,
> + target.id <http://target.id>, target.address, target.version,
> target.parent, rr.name <http://rr.name>, zone.name <http://zone.name>,
> + i.id <http://i.id>, i.number, i.admin_status, i.monitored,
> i.contactlist,
> + bgppeering.bgppeeraddr, bgppeering.monitored
> + FROM rr, zone, interface i, device d
> + LEFT JOIN ipblock target ON d.snmp_target=target.id <http://target.id>
> + LEFT JOIN entity ON d.used_by=entity.id <http://entity.id>
> + LEFT JOIN devicecontacts ON d.id <http://d.id>=devicecontacts.device
> + LEFT JOIN contactlist ON contactlist.id
> <http://contactlist.id>=devicecontacts.contactlist
> + LEFT JOIN bgppeering ON d.id <http://d.id>=bgppeering.device
> + WHERE d.monitored='true'
> +AND i.device=d.id <http://d.id>
> +AND d.name <http://d.name>=rr.id <http://rr.id>
> +AND rr.zone=zone.id <http://zone.id>
> + ");
> + }
>
> $logger->debug("Netdot::Exporter::get_device_info: building data
> structure");
> foreach my $row ( @$rows ){
>
>
> --Karl
>
> Karl Putland
> Senior VoIP Engineer
>
> *SimpleSignal*
> 3600 S Yosemite, Suite 150
> Denver, CO 80237
> One Number Rings All My Phones: 303-242-8608
>
> SimpleSignal.com <http://www.simplesignal.com/> | Blog
> <http://www.simplesignal.com/blog> | Facebook
> <http://www.facebook.com/SimpleSignal?ref=ts> | Twitter
> <http://twitter.com/simplesignal>
>
>
>
> _______________________________________________
> Netdot-devel mailing list
> [email protected]
> https://osl.uoregon.edu/mailman/listinfo/netdot-devel
>
--
cv
------------------------------
Message: 3
Date: Wed, 12 Sep 2012 16:29:51 -0600
From: Karl Putland <[email protected]>
Subject: Re: [Netdot-devel] Exporter.pm Pg compat patch
To: Carlos Vicente <[email protected]>
Cc: [email protected]
Message-ID:
<CA+EXWsyD=dmath0puw1oe0iptaiacjdhzaajxgzjicu0fdx...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
Exporter fails while using Pg.
boolean to integer explicit cast required.
> - WHERE d.monitored=1
patch changes query for Pg to be
> + WHERE d.monitored='true'
--Karl
Karl Putland
Senior VoIP Engineer
*SimpleSignal*
3600 S Yosemite, Suite 150
Denver, CO 80237
One Number Rings All My Phones: 303-242-8608
SimpleSignal.com <http://www.simplesignal.com/> |
Blog<http://www.simplesignal.com/blog>
| Facebook <http://www.facebook.com/SimpleSignal?ref=ts> |
Twitter<http://twitter.com/simplesignal>
On Wed, Sep 12, 2012 at 4:05 PM, Carlos Vicente <[email protected]>wrote:
> Karl,
>
> It would be useful if you explain what the patch is about.
>
> Thanks,
>
> cv
>
> On 9/12/12 5:43 PM, Karl Putland wrote:
> > --- Netdot.orig/Exporter.pm2012-08-22 20:22:42.175837081 +0000
> > +++ Netdot/Exporter.pm2012-09-11 17:35:15.191837116 +0000
> > @@ -58,6 +58,7 @@
> > }
> >
> > $self->{_dbh} = Netdot::Model->db_Main();
> > + $self->{_db_type} = Netdot::Model->config->get('DB_TYPE');
> > return $self;
> > }
> >
> > @@ -73,28 +74,49 @@
> > =cut
> > sub get_device_info {
> > my ($self) = @_;
> > + my $rows;
> >
> > return $self->cache('exporter_device_info')if
> > $self->cache('exporter_device_info');
> >
> > my %device_info;
> > $logger->debug("Netdot::Exporter::get_device_info: querying
> database");
> > - my $rows = $self->{_dbh}->selectall_arrayref("
> > - SELECT d.id <http://d.id>, d.snmp_managed,
> d.community,
> > - d.down_from, d.down_until, entity.name
> > <http://entity.name>, contactlist.id <http://contactlist.id>,
> > - target.id <http://target.id>, target.address,
> > target.version, target.parent, rr.name <http://rr.name>, zone.name
> > <http://zone.name>,
> > - i.id <http://i.id>, i.number, i.admin_status,
> > i.monitored, i.contactlist,
> > - bgppeering.bgppeeraddr, bgppeering.monitored
> > - FROM rr, zone, interface i, device d
> > - LEFT JOIN ipblock target ON d.snmp_target=target.id
> > <http://target.id>
> > - LEFT JOIN entity ON d.used_by=entity.id <
> http://entity.id>
> > - LEFT JOIN devicecontacts ON d.id
> > <http://d.id>=devicecontacts.device
> > - LEFT JOIN contactlist ON contactlist.id
> > <http://contactlist.id>=devicecontacts.contactlist
> > - LEFT JOIN bgppeering ON d.id
> > <http://d.id>=bgppeering.device
> > - WHERE d.monitored=1
> > - AND i.device=d.id <http://d.id>
> > - AND d.name <http://d.name>=rr.id <http://rr.id>
> > - AND rr.zone=zone.id <http://zone.id>
> > - ");
> > + if ($self->{_db_type} eq "mysql") {
> > +my $rows = $self->{_dbh}->selectall_arrayref("
> > + SELECT d.id <http://d.id>, d.snmp_managed, d.community,
> > + d.down_from, d.down_until, entity.name <http://entity.name>,
> > contactlist.id <http://contactlist.id>,
> > + target.id <http://target.id>, target.address, target.version,
> > target.parent, rr.name <http://rr.name>, zone.name <http://zone.name>,
> > + i.id <http://i.id>, i.number, i.admin_status, i.monitored,
> > i.contactlist,
> > + bgppeering.bgppeeraddr, bgppeering.monitored
> > + FROM rr, zone, interface i, device d
> > + LEFT JOIN ipblock target ON d.snmp_target=target.id <
> http://target.id>
> > + LEFT JOIN entity ON d.used_by=entity.id <http://entity.id>
> > + LEFT JOIN devicecontacts ON d.id <http://d.id>=devicecontacts.device
> > + LEFT JOIN contactlist ON contactlist.id
> > <http://contactlist.id>=devicecontacts.contactlist
> > + LEFT JOIN bgppeering ON d.id <http://d.id>=bgppeering.device
> > + WHERE d.monitored=1
> > +AND i.device=d.id <http://d.id>
> > +AND d.name <http://d.name>=rr.id <http://rr.id>
> > +AND rr.zone=zone.id <http://zone.id>
> > + ");
> > + } elsif($self->{db_type} eq "Pg") {
> > +my $rows = $self->{_dbh}->selectall_arrayref("
> > + SELECT d.id <http://d.id>, d.snmp_managed, d.community,
> > + d.down_from, d.down_until, entity.name <http://entity.name>,
> > contactlist.id <http://contactlist.id>,
> > + target.id <http://target.id>, target.address, target.version,
> > target.parent, rr.name <http://rr.name>, zone.name <http://zone.name>,
> > + i.id <http://i.id>, i.number, i.admin_status, i.monitored,
> > i.contactlist,
> > + bgppeering.bgppeeraddr, bgppeering.monitored
> > + FROM rr, zone, interface i, device d
> > + LEFT JOIN ipblock target ON d.snmp_target=target.id <
> http://target.id>
> > + LEFT JOIN entity ON d.used_by=entity.id <http://entity.id>
> > + LEFT JOIN devicecontacts ON d.id <http://d.id>=devicecontacts.device
> > + LEFT JOIN contactlist ON contactlist.id
> > <http://contactlist.id>=devicecontacts.contactlist
> > + LEFT JOIN bgppeering ON d.id <http://d.id>=bgppeering.device
> > + WHERE d.monitored='true'
> > +AND i.device=d.id <http://d.id>
> > +AND d.name <http://d.name>=rr.id <http://rr.id>
> > +AND rr.zone=zone.id <http://zone.id>
> > + ");
> > + }
> >
> > $logger->debug("Netdot::Exporter::get_device_info: building data
> > structure");
> > foreach my $row ( @$rows ){
> >
> >
> > --Karl
> >
> > Karl Putland
> > Senior VoIP Engineer
> >
> > *SimpleSignal*
> > 3600 S Yosemite, Suite 150
> > Denver, CO 80237
> > One Number Rings All My Phones: 303-242-8608
> >
> > SimpleSignal.com <http://www.simplesignal.com/> | Blog
> > <http://www.simplesignal.com/blog> | Facebook
> > <http://www.facebook.com/SimpleSignal?ref=ts> | Twitter
> > <http://twitter.com/simplesignal>
> >
> >
> >
> > _______________________________________________
> > Netdot-devel mailing list
> > [email protected]
> > https://osl.uoregon.edu/mailman/listinfo/netdot-devel
> >
>
>
> --
> cv
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://osl.uoregon.edu/pipermail/netdot-devel/attachments/20120912/2e1ca67c/attachment.html
------------------------------
_______________________________________________
Netdot-devel mailing list
[email protected]
https://osl.uoregon.edu/mailman/listinfo/netdot-devel
End of Netdot-devel Digest, Vol 66, Issue 10
********************************************