Cacti/plugin_monitor

Monitor 2.3.6 A DB Exec Failed!, Error: Column 'monitor' cannot be null

Closed this issue · 9 comments

Monitor Version 2.3.6
cacti Version 1.2.9

Issue:

When you delete all devices and start from 0 devices when you attempt to add a new device either manually or through Autom8 the following error occurs

A DB Exec Failed!, Error: Column 'monitor' cannot be null
you will then see all device additions will fail

If you disable the monitor plugin the issue goes away if you re-enable monitor after the first device is created the issue with monitor is resolved as well

I believe the issue could be the monitor colum is set to Null no

monitor | char(3) | NO | | on | |

Ok I was able to fix this issue at least for me

ALTER TABLE host MODIFY monitor varchar(255) null;

monitor | varchar(255) | YES | | NULL | |

No more errors so far still testing

I would say that monitor should always be empty as default not null.

Hmm ok so does the script need to be updated for that ?

By default the entry into the DB is NULL no changing it to yes seems to correct the issue
Ive tested it multiple times now in the lab without issues since that change

not sure how you've managed to get that setup then as this is the current table addition code:

api_plugin_db_add_column ('monitor', 'host', array('name' => 'monitor', 'type' => 'char(3)', 'NULL' => false, 'default' => 'on', 'after' => 'disabled'));

As you can see, the default should be set to 'on' which means it's active. You should be able to update this to match by using:

ALTER TABLE `host` MODIFY `monitor` CHAR(3) NOT NULL default 'on';

I would suggest that before you run the above, you run the following before and after to monitor changes:

SHOW CREATE TABLE `host`\G

Ok I made the change seems to be fine but I swear all I have is the dev branch files
are we sure something wasn't tweaked in the code that changed that ?

Use git log -L to check the history of lines in a file. It's how I usually tell @cigamit or @TheWitness which one broke something (unless of course I did, then I just quietly fix it).

@netniV wise guy. True though.

This is resolved in the to be released 2.6