Netdot
Netdot copied to clipboard
Cronjob updatedevices.pl error
Hi,
moved from Ubuntu 14.04 to 20.04, all seems fine, but when executing the cronjob: $PREFIX/bin/updatedevices.pl -DFA
this error appear in /var/log/syslog
netdot: ERROR - DBD::mysql::st execute failed: Field 'use_network_broadcast' doesn't have a default value [for Statement "INSERT INTO ipblock#012 (address,prefix,version,status,first_seen,last_seen)#012 VALUES (?, ?, ?, ?, ?, ?)#012 ON DUPLICATE KEY UPDATE last_seen=VALUES(last_seen);" with ParamValues: 0='168492545', 1=32, 2=4, 3=IpblockStatus=HASH(0x55e286bc9fe8), 4='2022/07/21 02:15:02', 5='2022/07/21 02:15:02'] at /usr/share/perl5/DBIx/ContextualFetch.pm line 52.#012
That's weird. On ipblock table definition use_network_broadcast doesn't have a default value but when inserting a new ipblock a value should be provided (can't be NULL), on my ipblock table I have 281966 rows all of wich except 7 have a value of 0 (the others having 1). Try to isolate the device that is reporting that. Maybe there's a problem with it.
MariaDB [netdot]> describe ipblock;
+-----------------------+---------------+------+-----+---------------------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-----------------------+---------------+------+-----+---------------------+----------------+
| address | decimal(40,0) | NO | MUL | NULL | |
| description | varchar(128) | YES | | NULL | |
| first_seen | timestamp | NO | MUL | 1970-01-02 00:00:01 | |
| id | bigint(20) | NO | PRI | NULL | auto_increment |
| info | text | YES | | NULL | |
| interface | bigint(20) | YES | MUL | NULL | |
| last_seen | timestamp | NO | MUL | 1970-01-02 00:00:01 | |
| owner | bigint(20) | YES | MUL | NULL | |
| parent | bigint(20) | YES | MUL | NULL | |
| prefix | int(11) | NO | | NULL | |
| status | bigint(20) | NO | MUL | NULL | |
| use_network_broadcast | tinyint(1) | NO | | NULL | |
| used_by | bigint(20) | YES | MUL | NULL | |
| version | int(11) | NO | MUL | NULL | |
| vlan | bigint(20) | YES | MUL | NULL | |
| monitored | tinyint(1) | NO | | NULL | |
| rir | varchar(255) | YES | | NULL | |
| asn | bigint(20) | YES | MUL | NULL | |
Barring that, one workaround might be assigning use_network_broadcast a default value of 0. Don't think that'll break nothing. But do so at your own risk.
MariaDB [netdot]> ALTER TABLE ipblock ALTER use_network_broadcast SET DEFAULT 0;
A rollback would be:
MariaDB [netdot]> ALTER TABLE ipblock ALTER use_network_broadcast DROP DEFAULT;