root@librenms:/opt/librenms# ./validate.php
Component | Version |
---|---|
LibreNMS | 1.32.01 |
DB Schema | 209 |
PHP | 7.0.22-0ubuntu0.16.04.1 |
MySQL | 10.0.31-MariaDB-0ubuntu0.16.04.2 |
RRDTool | 1.5.5 |
SNMP | NET-SNMP 5.7.3 |
====================================
[OK] Database connection successful
[OK] Database schema correct
Our log is filled with log lines like this from time to time:
MySQL Error: Unknown column ‘component’ in ‘field list’ (INSERT INTO
component_statuslog
(component
,status
,message
) VALUES (‘29’,‘0’,‘Component Created’))
Looking at the table definition, the filed component
needs to be called component_id
in the INSERT statement:
MariaDB [librenms]> EXPLAIN component_statuslog;
±-------------±-----------------±-----±----±------------------±---------------+
| Field | Type | Null | Key | Default | Extra |
±-------------±-----------------±-----±----±------------------±---------------+
| id | int(11) unsigned | NO | PRI | NULL | auto_increment |
| component_id | int(11) unsigned | NO | MUL | NULL | |
| status | tinyint(1) | NO | | 0 | |
| message | text | YES | | NULL | |
| timestamp | timestamp | NO | | CURRENT_TIMESTAMP | |
±-------------±-----------------±-----±----±------------------±---------------+
The faulty code snippet seems to be inside LibreNMS/Component.php
:
public function createStatusLogEntry($component, $status, $message)
{
// Add an entry to the statuslog table for a particular component.
$DATA = array(
‘component’ => $component,
‘status’ => $status,
‘message’ => $message,
);
return dbInsert($DATA, ‘component_statuslog’);
}
The key of the first array element should be renamed to component_id, right?