hanzonizer
Programmer
Hi!
I don´t know if anyone has worked with netdisco (open source webbased networkdatabase), but I´m having problem writing a code that can ask a SQL-question (Postgre SQL) and retrieve the answer to a file. So far I have written this code:
The intention is to write a SQL-question like: SELECT ip FROM device_port WHERE up = "up" AND vlan IS NOT NULL
(vlan = IS NOT NULL is not included here) but I only get an errormessage saying:
Can't locate netdisco/DB.pm in @INC (@INC contains: /etc/perl /usr/local/lib/per l/5.8.7 /usr/local/share/perl/5.8.7 /usr/lib/perl5 /usr/share/perl5 /usr/lib/per l/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl .) at ./get_ip_adresses.pl li ne 9.
BEGIN failed--compilation aborted at ./get_ip_adresses.pl line 9.
I came to realize that the directories it searches DB.pm in does not exist on my installation of netdisco. How can you fix this? can u just move DB.pm to a valid directory, or do you need to specify it? I´m kind of new to this, and NOT a linux hacker, so please keep it simple
Regards /Jimmy
I don´t know if anyone has worked with netdisco (open source webbased networkdatabase), but I´m having problem writing a code that can ask a SQL-question (Postgre SQL) and retrieve the answer to a file. So far I have written this code:
Code:
#! /usr/bin/perl -w
#
# Usage:
# Fetch IP-adresses from routers that the script
# show_mac_ip needs to be run on (for reading MAC-adresses to netdisco)
#
use netdisco qw/:all/;
use netdisco::DB;
$matches = sql_rows('device_port',['ip'],{'up' => 'up'});
print $matches;
The intention is to write a SQL-question like: SELECT ip FROM device_port WHERE up = "up" AND vlan IS NOT NULL
(vlan = IS NOT NULL is not included here) but I only get an errormessage saying:
Can't locate netdisco/DB.pm in @INC (@INC contains: /etc/perl /usr/local/lib/per l/5.8.7 /usr/local/share/perl/5.8.7 /usr/lib/perl5 /usr/share/perl5 /usr/lib/per l/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl .) at ./get_ip_adresses.pl li ne 9.
BEGIN failed--compilation aborted at ./get_ip_adresses.pl line 9.
I came to realize that the directories it searches DB.pm in does not exist on my installation of netdisco. How can you fix this? can u just move DB.pm to a valid directory, or do you need to specify it? I´m kind of new to this, and NOT a linux hacker, so please keep it simple

Regards /Jimmy