Giter Club home page Giter Club logo

Comments (29)

tshetum avatar tshetum commented on June 14, 2024

Is the netnot software absolute ?

Thanks

from netdot.

candlerb avatar candlerb commented on June 14, 2024

Is the netnot software absolute ?

That sounds like a very philosophical question. Or did you miss an adjective before the question mark? :-)

Please ask your question in a smart way. Since Netdot works for other people, you need to include the information which might indicate what's different for your installation. In particular:

  • What version of Netdot did you install?
  • What documentation did you follow to install it?
  • What operating system is it installed under (type and version)?
  • What Apache version?
  • What database are you using (type and version)?

The error "Can't get last insert id" would appear to be database related. It looks like you have hit this issue with Class::DBI

There was a bug report for this on the osl.uoregon.edu bug tracker, including the fixes, but sadly that site appears to have gone away permanently.

To get netdot to work with ubuntu 16.04 I need several patches, here is one:

# Needed for mysql 5.7
# https://osl.uoregon.edu/redmine/issues/1911
# Patch taken from:
# https://rt.cpan.org/Public/Bug/Display.html?id=118491

--- Class/DBI.pm.orig	2007-10-04 21:27:07.000000000 +0000
+++ Class/DBI.pm	2017-03-24 12:01:07.829877222 +0000
@@ -597,6 +597,7 @@

 sub _auto_increment_value {
 	my $self = shift;
+	my $sth = shift;
 	my $dbh  = $self->db_Main;

 	# Try to do this in a standard method. Fall back to MySQL/SQLite
@@ -607,6 +608,7 @@
 	my $id = $dbh->last_insert_id(undef, undef, $self->table, undef)    # std
 		|| $dbh->{mysql_insertid}                                         # mysql
 		|| eval { $dbh->func('last_insert_rowid') }
+		|| $sth->{'mysql_insertid'} # Added for MySQL 5.7
 		or $self->_croak("Can't get last insert id");
 	return $id;
 }
@@ -623,7 +625,7 @@
 		$self->_bind_param($sth, \@columns);
 		$sth->execute(values %$data);
 		my @primary_columns = $self->primary_columns;
-		$data->{ $primary_columns[0] } = $self->_auto_increment_value
+		$data->{ $primary_columns[0] } = $self->_auto_increment_value($sth)
 			if @primary_columns == 1
 			&& !defined $data->{ $primary_columns[0] };
 	};

And here is another:

--- apache2.orig        2017-03-21 13:36:56.712133397 +0000
+++ apache2     2017-03-21 13:37:35.928572194 +0000
@@ -159,8 +159,12 @@
        fi

        if apache_conftest ; then
+               # Utterly horrible workaround for https://osl.uoregon.edu/redmine/issues/1904
+               a2disconf netdot
                $APACHE2CTL start
                apache_wait_start $?
+               a2enconf netdot
+               $APACHE2CTL graceful
                return $?
        else
                APACHE2_INIT_MESSAGE="The apache2$DIR_SUFFIX configtest failed."

Plus a change to mysql.conf:

[mysqld]
max_allowed_packet = 16M

from netdot.

candlerb avatar candlerb commented on June 14, 2024

See also #48

from netdot.

tshetum avatar tshetum commented on June 14, 2024

Please find my server details :
OS : Ubuntu 16.04.1
Netdot : 1.0.7
apache: Apache/2.4.18 (Ubuntu)

and I followed following links:
https://workshops.nsrc.org/dokuwiki/2016/apricot2016-nmm/exercises/exercises-netdot
http://htmlpreview.github.io/?https://github.com/cvicente/Netdot/blob/master/doc/manual/netdot-manual.html

Even we I try to add the device from the web panel it giving following error: evice.html produced the following error:

Management -> Devices-> new -> Add Device manually
Error while inserting Device: Can't insert new Device: Can't get last insert id at /usr/local/netdot/htdocs/management/device.html line 147.

Management -> Devices-> new-> Discover Device
Error while inserting Entity: Can't insert new Entity: Can't get last insert id at /usr/local/netdot/htdocs/management/updatedevice.html line 241.

from netdot.

candlerb avatar candlerb commented on June 14, 2024

and I followed following links:
https://workshops.nsrc.org/dokuwiki/2016/apricot2016-nmm/exercises/exercises-netdot

That workshop was using Ubuntu 14.04 (in February 2016, before Ubuntu 16.04 was released)

http://htmlpreview.github.io/?https://github.com/cvicente/Netdot/blob/master/doc/manual/netdot-manual.html

Looks like the issues for Ubuntu 16.04 / mysql 5.7 have not been documented there.

You'll need to apply the patches I posted above by hand. The DBI patch is to /usr/share/perl5/Class/DBI.pm. You'll need to restart apache after this change.

The apache patch is to /etc/init.d/apache2, but it seems you have now been able to get apache to start so it might not be needed.

from netdot.

tshetum avatar tshetum commented on June 14, 2024

I have applied the patches and replaced the netnot.conf under /etc/apache2/sites-available but again apache is not able to start after I tired to add devices in netdot.

Thanks

from netdot.

candlerb avatar candlerb commented on June 14, 2024

I don't understand what you mean by "replaced the netnot.conf [sic] under /etc/apache2/sites-available". I didn't say to change anything under sites-available. What did you change?

from netdot.

tshetum avatar tshetum commented on June 14, 2024

I meant the I have recreated the symbolic link using ln -s /usr/local/netdot/etc/netdot_apache24_local.conf sites-available/netdot.conf.

Regards,

from netdot.

candlerb avatar candlerb commented on June 14, 2024

OK, well if Apache won't start then try the fix to /etc/init.d/apache2 that I posted (basically it removes the netdot site, restarts apache, adds the netdot site and sends a graceful reload).

And if that doesn't work, show your Apache error log.

from netdot.

tshetum avatar tshetum commented on June 14, 2024

Dear Candlerb,
Please share the documentation link , as I would like to go for fresh installation of netdot.

Thanks

from netdot.

candlerb avatar candlerb commented on June 14, 2024

The netdot manual that you linked to earlier is the documentation. As I said, it has not been updated to cover the workarounds needed for Ubuntu 16.04.

I don't see any particular reason to reinstall though. Change the two files I showed, restart apache, and then if you are still seeing an error, show what you see.

from netdot.

tshetum avatar tshetum commented on June 14, 2024

I have changed two files and re run the following command to discover the devices but it is giving following error:
root@netdot:/usr/local/netdot# sudo bin/updatedevices.pl -E /home/discoverme.txt -IAF
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_PAPER = "dz_BT",
LC_ADDRESS = "dz_BT",
LC_MONETARY = "dz_BT",
LC_NUMERIC = "dz_BT",
LC_TELEPHONE = "dz_BT",
LC_IDENTIFICATION = "dz_BT",
LC_MEASUREMENT = "dz_BT",
LC_TIME = "dz_BT",
LC_NAME = "dz_BT",
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
INFO - bin/updatedevices.pl started at Tue May 22 10:05:02 2018
INFO - Updating all devices in given file: /home/tshetum/discoverme.txt
INFO - Using traditional method for SNMP collection
RR RR destroyed without saving changes to modified at bin/updatedevices.pl line 220.
ERROR - Error while inserting RR: Can't insert new RR: Can't get last insert id at bin/updatedevices.pl line 220.
at bin/updatedevices.pl line 220.

ERROR - Error while inserting Zone: Can't insert new Zone: Can't get last insert id at /usr/local/netdot/lib/Netdot/Model/RR.pm line 178.
at /usr/local/netdot/lib/Netdot/Model/RR.pm line 178.

RR RR destroyed without saving changes to modified at bin/updatedevices.pl line 220.
ERROR - Error while inserting RR: Can't insert new RR: Can't get last insert id at bin/updatedevices.pl line 220.
at bin/updatedevices.pl line 220.

Error while inserting DataCache: Can't insert new DataCache: Can't get last insert id at /usr/local/netdot/lib/Netdot/Model/Device.pm line 4693.
at /usr/local/netdot/lib/Netdot/Model/Device.pm line 4693.

from netdot.

tshetum avatar tshetum commented on June 14, 2024

apache error log:

[Tue May 22 13:04:01.492508 2018] [:error] [pid 6698:tid 140428049381120] Got user object: Apache2::SiteControl::User=HASH(0x7fb7cc1c4138)
[Tue May 22 13:04:01.492540 2018] [:error] [pid 6698:tid 140428049381120] AuthName is not set! Using 'default'.
[Tue May 22 13:04:01.497413 2018] [:error] [pid 6698:tid 140428049381120] AuthName is not set! Using 'default'.
[Tue May 22 13:04:01.499349 2018] [:error] [pid 6698:tid 140428049381120] Session cookie: b13fef79b7cfaae8403bbcb71edaa9f8
[Tue May 22 13:04:01.499371 2018] [:error] [pid 6698:tid 140428049381120] Loading module Apache2::SiteControl::UserFactory
[Tue May 22 13:04:01.499434 2018] [:error] [pid 6698:tid 140428049381120] Using user factory Apache2::SiteControl::UserFactory
[Tue May 22 13:04:01.499449 2018] [:error] [pid 6698:tid 140428049381120] user name is admin
[Tue May 22 13:04:01.499460 2018] [:error] [pid 6698:tid 140428049381120] Evaluating: $user = Apache2::SiteControl::UserFactory->findUser($r,
$ses_key)
[Tue May 22 13:04:01.499511 2018] [:error] [pid 6698:tid 140428049381120] encryption engine using key: Netdot gets the last laugh
[Tue May 22 13:04:01.499906 2018] [:error] [pid 6698:tid 140428049381120] Restored user: $VAR1 = bless( {\n 'attributes' => {
n 'USER_TYPE' => 'Admin',\n 'SHOW_TASKS' => 'show',\n
'session_removed' => 0,\n 'MANAGEMENT_PAGE' => 'DEVICE',\n '
CONTACTS_PAGE' => 'ENTITIES',\n 'ALLOWED_OBJECTS' => {}\n },\n
'manager' => 'Apache2::SiteControl::UserFactory',\n 'username' => 'admin',\n 'sessionid' => 'b13fef79b7cfaa
e8403bbcb71edaa9f8'\n }, 'Apache2::SiteControl::User' );\n
[Tue May 22 13:04:01.500006 2018] [:error] [pid 6698:tid 140428049381120] Got user object: Apache2::SiteControl::User=HASH(0x7fb7cc29b6f8)
[Tue May 22 13:04:01.500063 2018] [:error] [pid 6698:tid 140428049381120] AuthName is not set! Using 'default'.
[Tue May 22 13:04:01.517648 2018] [:error] [pid 6698:tid 140428049381120] Session cookie: b13fef79b7cfaae8403bbcb71edaa9f8
[Tue May 22 13:04:01.517669 2018] [:error] [pid 6698:tid 140428049381120] Loading module Apache2::SiteControl::UserFactory
[Tue May 22 13:04:01.517710 2018] [:error] [pid 6698:tid 140428049381120] Using user factory Apache2::SiteControl::UserFactory
[Tue May 22 13:04:01.517723 2018] [:error] [pid 6698:tid 140428049381120] user name is admin
[Tue May 22 13:04:01.517733 2018] [:error] [pid 6698:tid 140428049381120] Evaluating: $user = Apache2::SiteControl::UserFactory->findUser($r,
$ses_key)
[Tue May 22 13:04:01.517820 2018] [:error] [pid 6698:tid 140428049381120] encryption engine using key: Netdot gets the last laugh
[Tue May 22 13:04:01.518136 2018] [:error] [pid 6698:tid 140428049381120] Restored user: $VAR1 = bless( {\n 'attributes' => {
n 'USER_TYPE' => 'Admin',\n 'SHOW_TASKS' => 'show',\n
'session_removed' => 0,\n 'MANAGEMENT_PAGE' => 'DEVICE',\n '
CONTACTS_PAGE' => 'ENTITIES',\n 'ALLOWED_OBJECTS' => {}\n },\n
'manager' => 'Apache2::SiteControl::UserFactory',\n 'username' => 'admin',\n 'sessionid' => 'b13fef79b7cfaa
e8403bbcb71edaa9f8'\n }, 'Apache2::SiteControl::User' );\n
[Tue May 22 13:04:01.518218 2018] [:error] [pid 6698:tid 140428049381120] Got user object: Apache2::SiteControl::User=HASH(0x7fb7cc2f17a8)
[Tue May 22 13:04:30.840729 2018] [mpm_event:notice] [pid 6257:tid 140428465153920] AH00493: SIGUSR1 received. Doing graceful restart
[Tue May 22 13:04:31.289341 2018] [core:notice] [pid 6257:tid 140428465153920] AH00060: seg fault or similar nasty error detected in the paren
t process

from netdot.

candlerb avatar candlerb commented on June 14, 2024

ERROR - Error while inserting RR: Can't insert new RR: Can't get last insert id at bin/updatedevices.pl line 220.

And you are 100% sure that you have edited /usr/share/perl5/Class/DBI.pm and applied the changes I showed?? (That is, inserting two new lines and changing one line). If so, I'm afraid I can't help you; those changes should have fixed the problem.

In that case, the only option I can give you is to reinstall your machine or VM with Ubuntu 14.04, and install Netdot on that. But note that Ubuntu 14.04 will be end-of-life in just under one year.

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:

That warning can probably be ignored, although might be able to fix it by:

# apt-get install locales
# vi /etc/locale.gen
-- ensure that the lines "dz_BT UTF-8" and "en_US.UTF-8 UTF-8" are uncommented, then save

# locale-gen
# update-locale LANG="en_US.UTF-8" LANGUAGE="en_US:en"

You might also want to check the contents of /etc/default/locale

from netdot.

tshetum avatar tshetum commented on June 14, 2024

--- Class/DBI.pm.orig 2007-10-04 21:27:07.000000000 +0000
+++ Class/DBI.pm 2017-03-24 12:01:07.829877222 +0000
@@ -597,6 +597,7 @@

sub _auto_increment_value {
my $self = shift;

  •   my $sth = shift;
      my $dbh  = $self->db_Main;
    
      # Try to do this in a standard method. Fall back to MySQL/SQLite
    

@@ -607,6 +608,7 @@
my $id = $dbh->last_insert_id(undef, undef, $self->table, undef) # std
|| $dbh->{mysql_insertid} # mysql
|| eval { $dbh->func('last_insert_rowid') }

  •           || $sth->{'mysql_insertid'} # Added for MySQL 5.7
              or $self->_croak("Can't get last insert id");
      return $id;
    

}
@@ -623,7 +625,7 @@
$self->_bind_param($sth, @columns);
$sth->execute(values %$data);
my @primary_columns = $self->primary_columns;

  •           $data->{ $primary_columns[0] } = $self->_auto_increment_value
    
  •           $data->{ $primary_columns[0] } = $self->_auto_increment_value($sth)
                      if @primary_columns == 1
                      && !defined $data->{ $primary_columns[0] };
      };
    

This is what I have appended at the end of file under /usr/share/perl5/Class/DBI.pm

from netdot.

tshetum avatar tshetum commented on June 14, 2024

Error while inserting Ipblock: Can't insert new Ipblock: Can't get last insert id at /usr/local/netdot/htdocs/management/ip.html line 330.

I am getting this error even when I add IP manually.
Thanks

from netdot.

candlerb avatar candlerb commented on June 14, 2024

Aside: to make your diff format properly in github, edit the comment, and add three backticks (```) on a line of their own before and after it.

However, I'm not sure I believe your diff, because it shows +++ Class/DBI.pm 2017-03-24 12:01:07.829877222 +0000: that's when I edited my local copy of file, not when you did.

What exact command did you use to generate that diff you posted?

from netdot.

tshetum avatar tshetum commented on June 14, 2024

Oh I have just done copy paste in /usr/share/perl5/Class/DBI.pm

Thanks

from netdot.

tshetum avatar tshetum commented on June 14, 2024

I have just copy and paste in /usr/share/perl5/Class/DBI.pm and /etc/init.d/apache2

from netdot.

candlerb avatar candlerb commented on June 14, 2024

It's not direct copy-paste. You are looking at a "unified diff": each line which starts with a - indicates a line which is in the old file but not in the new, and each line which starts with + indicates a line in the new file but not the old.

If a line is changed, the old and new versions have - and + respectively. So if you see:

 foo
-bar
+baz
 qux

means you find the line "bar" and change it to "baz". The line numbers in the header (@@) give you a rough indication of where to find the lines which need changing.

from netdot.

tshetum avatar tshetum commented on June 14, 2024

Thanks for your time.
Thanks

from netdot.

tshetum avatar tshetum commented on June 14, 2024

Is it possible to integrate librenms with Netdot?

Thanks

from netdot.

candlerb avatar candlerb commented on June 14, 2024

Were you successful in getting Netdot to run?

I simply run Netdot alongside LibreNMS, and add devices into both. To automate that would require writing code to export from Netdot and import into LibreNMS. Perhaps it could be based on the Cacti exporter.

from netdot.

tshetum avatar tshetum commented on June 14, 2024

Yes, we have different servers for them. So to get the topology in Netdot we need NMS server running rite ?

Thanks

from netdot.

candlerb avatar candlerb commented on June 14, 2024

So to get the topology in Netdot we need NMS server running rite ?

Not sure what you mean. Netdot will display topology based on information it learns from LLDP and bridge tables, but it doesn't always work depending on exactly what types of device you have.

Where it says "NMS_DEVICE" in netdot.conf generally you put the server which is running Netdot itself; and you have to ensure that that server is also present in Netdot.

from netdot.

tshetum avatar tshetum commented on June 14, 2024

Thanks for the info. I have done exactly the same but not getting topology.

Thanks

from netdot.

candlerb avatar candlerb commented on June 14, 2024

Try navigating to a single device (say a switch) and then looking at the topology tab. Does it show anything? You can increase the number of levels to 2, 3... to see increasing areas of topology.

If nothing is shown, then look at the list of interfaces on a device. Does it show any neighbors, where you would expect connections to be?

from netdot.

tshetum avatar tshetum commented on June 14, 2024

screenshot from 2018-05-30 10-28-50

Showing only this much as shown in the picture attached here . Moreover, interfaces are not showing any information about the neighbors besides the their status ( up/down).
Thanks

from netdot.

candlerb avatar candlerb commented on June 14, 2024

If you go to device "cr" and the "Interfaces" tab then the neighbors information is the source of the topology data. If it's not being populated then you won't see any topology.

What type of device is "cr"? It should support exposing LLDP or CDP tables in SNMP. If those aren't available then Netdot will attempt to use bridge forwarding tables, but that's not a very reliable way to find topology.

So you need to ensure that either LLDP or CDP is enabled on this device (and all the ports) and on all the neighbor devices it's plugged into. Get to the point where "show lldp neighbors" or equivalent command is working.

Then you'll need to run updatedevices.pl in debugging mode:

cd /usr/local/netdot
bin/updatedevices.pl -H cr.thimpu.drukren.bt -IFT -d

See if you can work out why it's not finding neighbors. If not, you can paste the results here (you can mask out any public IP addresses)

from netdot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.