Linux · 2015年3月6日 0

nagios+cacti+npc整合问题 ndo2db: mysql_error: ‘Unknown column ‘importance’ in ‘field list”

日志错误信息 ndo2db: mysql_error: ‘Unknown column ‘importance’ in ‘field list”

解决方法执行  mysql-upgrade-2.0.0.sql(这个文件在ndoutils-2.0.0/db/mysql-upgrade-2.0.0.sql这个位置。)

方法

mysl -uroot -p

mysql> use nagios;

mysql> source /home/anzhuangbao/ndoutils-2.0.0/db/mysql-upgrade-2.0.0.sql

如果soucre报如下错误

ERROR 1146 (42S02): Table ‘nagios.nagios_notifications’ doesn’t exist
ERROR 1146 (42S02): Table ‘nagios.nagios_contactnotifications’ doesn’t exist
ERROR 1146 (42S02): Table ‘nagios.nagios_contactnotificationmethods’ doesn’t exist
ERROR 1146 (42S02): Table ‘nagios.nagios_logentries’ doesn’t exist
ERROR 1146 (42S02): Table ‘nagios.nagios_acknowledgements’ doesn’t exist
ERROR 1146 (42S02): Table ‘nagios.nagios_contacts’ doesn’t exist
ERROR 1146 (42S02): Table ‘nagios.nagios_hosts’ doesn’t exist
ERROR 1146 (42S02): Table ‘nagios.nagios_services’ doesn’t exist
Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)
Statement prepared

+——————————+
| INFO: Index does not exists. |
+——————————+
| INFO: Index does not exists. |
+——————————+
1 row in set (0.00 sec)

ERROR 1146 (42S02): Table ‘nagios.nagios_logentries’ doesn’t exist
Query OK, 0 rows affected, 1 warning (0.00 sec)

请将mysql-upgrade-2.0.0.sql里所有nagios_修改为npc_

再次执行

mysql> source /home/anzhuangbao/ndoutils-2.0.0/db/mysql-upgrade-2.0.0.sql
Query OK, 0 rows affected (0.29 sec)
Records: 0 Duplicates: 0 Warnings: 0

Query OK, 0 rows affected (0.26 sec)
Records: 0 Duplicates: 0 Warnings: 0

Query OK, 0 rows affected (0.34 sec)
Records: 0 Duplicates: 0 Warnings: 0

Query OK, 0 rows affected (1.00 sec)
Records: 0 Duplicates: 0 Warnings: 0

Query OK, 0 rows affected (0.26 sec)
Records: 0 Duplicates: 0 Warnings: 0

Query OK, 0 rows affected (0.57 sec)
Records: 0 Duplicates: 0 Warnings: 0

Query OK, 0 rows affected (1.09 sec)
Records: 0 Duplicates: 0 Warnings: 0

Query OK, 0 rows affected (0.94 sec)
Records: 0 Duplicates: 0 Warnings: 0

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)
Statement prepared

+——————————+
| INFO: Index does not exists. |
+——————————+
| INFO: Index does not exists. |
+——————————+
1 row in set (0.00 sec)

Query OK, 0 rows affected (0.69 sec)
Records: 0 Duplicates: 0 Warnings: 0

Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> \q
Bye

问题解决。