Welcome, Guest. Please login or register.

Author Topic: After 1.6C update: "Threaded" discovery doesn't work anymore  (Read 278 times)

Paraidomat

  • Newbie
  • *
  • Posts: 7
    • View Profile
After 1.6C update: "Threaded" discovery doesn't work anymore
« on: October 16, 2017, 11:26:44 AM »
Hi,

I just updated to 1.6C and had to find out, that my usual cronjob for the discovery doesn't work anymore.

These were my cronjob:

Code: [Select]
  0  0,6,12,18  *  *  * root /var/nedi/nedi.pl -B0 -SGgw -A "devos not like '\%orti\%' order by device asc limit 200" 2>&1 1>/dev/null
  0  0,6,12,18  *  *  * root /var/nedi/nedi.pl -B0 -SGgw -A "devos not like '\%orti\%' order by device asc limit 200,200" 2>&1 1>/dev/null
  0  0,6,12,18  *  *  * root /var/nedi/nedi.pl -B0 -SGgw -A "devos not like '\%orti\%' order by device asc limit 400,200" 2>&1 1>/dev/null
  0  0,6,12,18  *  *  * root /var/nedi/nedi.pl -B0 -SGgw -A "devos not like '\%orti\%' order by device asc limit 600,200" 2>&1 1>/dev/null

I know that this was an unusual "hack" but with 1.6C it doesn't seem to work anymore:

Code: [Select]
[root@nedi ~]# /var/nedi/nedi.pl -B0 -SGgw -A "devos not like '\%orti\%' order by device asc limit 200"
DBD::mysql::db selectall_arrayref failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND snmpversion > 0' at line 1 at /var/nedi/inc/libdb.pm line 2002.
DBD::mysql::db selectall_arrayref failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND snmpversion > 0' at line 1 at /var/nedi/inc/libdb.pm line 2002.

Does anyone know another workaround, so that i can use the potential of my server with 4 threads?

BR from Germany,
Paraidomat

rickli

  • Administrator
  • Hero Member
  • *****
  • Posts: 2558
    • View Profile
    • NeDi
Re: After 1.6C update: "Threaded" discovery doesn't work anymore
« Reply #1 on: October 17, 2017, 11:15:25 AM »
1.6 allows to match on device configs, which changed how the -A query is used.
It will work again in 1.7 onwards...

You can change line 1355 in libmisc.pm to make it work again for 1.6:

         $query    = $query?"snmpversion > 0 AND $query":"snmpversion > 0" unless $_[0] == 2;
Please consider Other-Invoices on your NeDi installation for an annual contribution, tx!
-Remo

tristanbob

  • Full Member
  • ***
  • Posts: 143
    • View Profile
Re: After 1.6C update: "Threaded" discovery doesn't work anymore
« Reply #2 on: October 18, 2017, 07:32:38 PM »
I just wanted to say, Paraidomat, that is a neat hack to make Nedi discover 1/4 of your devices at the same time!

How does it handle new devices?  For instance, if a new device was plugged into existing two devices, which are being discovered by different Nedi processes?  Would the new device get added twice?  Or would the second process simply output an error, like "device exists, skipping".
Please visit "Other"->"Invoices" on your NeDi installation to make an annual contribution and support Nedi!

Paraidomat

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: After 1.6C update: "Threaded" discovery doesn't work anymore
« Reply #3 on: November 02, 2017, 09:32:03 AM »
You can change line 1355 in libmisc.pm to make it work again for 1.6:

Hi Remo,

thanks so much, i'm testing it right now.

I just wanted to say, Paraidomat, that is a neat hack to make Nedi discover 1/4 of your devices at the same time!

How does it handle new devices?  For instance, if a new device was plugged into existing two devices, which are being discovered by different Nedi processes?  Would the new device get added twice?  Or would the second process simply output an error, like "device exists, skipping".

Hi tristanbob!

Thank you ...

Since the device name is the primary key i would assume it would not get added twice.
But I think it would be discovered twice, since the first NeDi process is not aware of the second process and vice versa.


Please see what Remo wrote after me.

BR from Germany,
Paraidomat
« Last Edit: November 06, 2017, 12:17:20 PM by Paraidomat »

rickli

  • Administrator
  • Hero Member
  • *****
  • Posts: 2558
    • View Profile
    • NeDi
Re: After 1.6C update: "Threaded" discovery doesn't work anymore
« Reply #4 on: November 06, 2017, 11:48:51 AM »
This should really be avoided! The 2nd thread will terminate as it tries to add the new devices as well. NeDi reads all existing devices at the beginning and won't check again (would decrease performance).
Please consider Other-Invoices on your NeDi installation for an annual contribution, tx!
-Remo

Paraidomat

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: After 1.6C update: "Threaded" discovery doesn't work anymore
« Reply #5 on: November 06, 2017, 12:20:45 PM »
Hi,

good point, Remo.

Since i only use this to "rediscover" / keep track of the devices i already got into my NeDi i shouldn't get into any trouble...

BR from Germany,
Paraidomat