centreon安装使用过程日志错误处理

  按照上篇centreon部署文档安装centreon服务器,使用时发现centreon、nagios、系统日志出现很多报错,并且centreonweb页面不能查看监控到的主机状态,现将错误处理记录如下。


1、使用service ndo2db start 启动nod2db时,报错:

   Starting ndo2db:Could not bind socket:  Address already in usedone. 

   使用service ndo2db status 查看状态时,报错:

   ndo2db is not running but subsystem locked .

解决办法:

   #vim /usr/local/nagios/etc/ndo2db.cfg

    socket_name=/var/run/ndo.sock

    lock_file=/usr/local/nagios/var/ndo2db.lock

   #killall ndo2db  

   #service ndo2db restart


2、nagios日志

   SERVER ndo2db: Warning: queue send error, retrying...

解决办法:

   #vim /etc/sysctl.conf

    kernel.msgmax = 131072000

    kernel.msgmnb = 131072000

    kernel.msgmni = 65536000


3、/usr/local/centreon/log/nagiosPerfTrace.log

   Error: Can't locate /etc/centreon/conf.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /usr/share/perl5/vendor_perl/centreon/script.pm line 140.

解决办法:

   #vim /usr/share/perl5/vendor_perl/centreon/script.pm 

    config_file => "/usr/local/centreon/etc/conf.pm"


4、/usr/local/centreon/log/centreontrapd.log

   couldn't do /etc/centreon/centreontrapd.pm: No such file or directory

   couldn't run /etc/centreon/centreontrapd.pm

解决办法:

   #find / -name centreontrapd.fp  

    /usr/share/perl5/vendor_perl/centreon/script/centreontrapd.pm

   #vim /usr/share/perl5/vendor_perl/centreon/scripte/centreontrapd.pm

    /etc/centreon/centreontrapd.pm

    /usr/share/perl5/vendor_perl/centreon/script/centreontrapd.pm(替换)


5、nagios的bug

   nagios日志报错 wproc: Unknown job type: 10

   补丁如下

diff --git a/base/workers.c b/base/workers.c
index 881e434..d1e1f8d 100644
--- a/base/workers.c
+++ b/base/workers.c
@@ -285,6 +285,8 @@ static void destroy_job(struct wproc_job *job)
    case WPJOB_SVC_EVTHANDLER:
    case WPJOB_GLOBAL_HOST_EVTHANDLER:
    case WPJOB_HOST_EVTHANDLER:
+   case WPJOB_HOST_PERFDATA:
+   case WPJOB_SVC_PERFDATA:
        /* these require nothing special */
        break;
    case WPJOB_CALLBACK:
@@ -763,6 +765,11 @@ static int handle_worker_result(int sd, int events, void *arg)
            run_job_callback(job, &wpres, 0);
            break;
+       case WPJOB_HOST_PERFDATA:
+       case WPJOB_SVC_PERFDATA:
+           /* these require nothing special */
+           break;
+
        default:
            logit(NSLOG_RUNTIME_WARNING, TRUE, "Worker %d: Unknown jobtype: %d\n", wp->pid, job->type);
            break;


6、/var/log/message 有很多数据库报错

   ndo2db: Error: mysql_query() failed for 'INSERT INTO nagios_programstatus SET instance_id='1', status_update_time=FROM_UNIXTIME(1397007698), program_start_time=FROM_UNIXTIME(1397007639), is_currently_running='1', process_id='4841', daemon_mode='1', last_command_check=FROM_UNIXTIME(0), last_log_rotation=FROM_UNIXTIME(0), notifications_enabled='1', active_service_checks_enabled='1', passive_service_checks_enabled='1', active_host_checks_enabled='1', passive_host_checks_enabled='1', event_handlers_enabled='1', flap_detection_enabled='0', failure_prediction_enabled='0', process_performance_data='1', obsess_over_hosts='0', obsess_over_services='0', modified_host_attributes='0', modified_service_attributes='0', global_host_event_handler='', global_service_event_handler='' ON DUPLICATE KEY UPDATE instance_id='1', status_update_time=FROM_UNIXTIME(1397007698), program_start_time=FROM_UNIXTIME(1397007639), is_currently_running='1', process_id='4841', daemon_mode='1', last_command_check=FROM_UNIXTIME(0), last_log_rotation=FROM_UNIXTIME(0), notifications_enabled='1', active_service_checks_enabled='1', passive_service_checks_enabled='1', active_host_checks_enabled='1', passive_host_checks_enabled='1', event_handlers_enabled='1', flap_detection_enabled='0', failure_prediction_enabled='0', process_performance_data='1', obsess_over_hosts='0', obsess_over_services='0', modified_host_attributes='0', modified_service_attributes='0', global_host_event_handler='', global_service_event_handler='''

    解决办法:

    连接至数据库

    INSERT INTO nagios_programstatus SET status_update_time=FROM_UNIXTIME(1397007698), program_start_time=FROM_UNIXTIME(1397007639), is_currently_running='1', process_id='4841', daemon_mode='1', last_command_check=FROM_UNIXTIME(0), last_log_rotation=FROM_UNIXTIME(0), notifications_enabled='1', active_service_checks_enabled='1', passive_service_checks_enabled='1', active_host_checks_enabled='1', passive_host_checks_enabled='1', event_handlers_enabled='1', flap_detection_enabled='0', failure_prediction_enabled='0', process_performance_data='1', obsess_over_hosts='0', obsess_over_services='0', mo dified_host_attributes='0', modified_service_attributes='0', global_host_event_handler='', global_service_event_handler=''


7、/var/log/messages中报错:

    ndo2db: Error: mysql_query() failed for 'DELETE FROM nagios_service_parentservices WHERE instance_id='1''

    ndo2db: mysql_error: 'Table 'centreon_status.nagios_service_parentservices' doesn't exist'

解决办法:

         连接数据库

         use centreon_status;

         create table nagios_service_parentservices( instance_id int(11) default 1);


8、/var/log/messages中报错:

ndo2db: Error: mysql_query() failed for 'INSERT INTO nagios_contacts SET instance_id='1', config_type='1', contact_object_id='60', alias='admin', email_address='danhanwen@sinoicity\.com', pager_address='', host_timeperiod_object_id='55', service_timeperiod_object_id='55', host_notifications_enabled='1', service_notifications_enabled='1', can_submit_commands='1', notify_service_recovery='0', notify_service_warning='0', notify_service_unknown='0', notify_service_critical='0', notify_service_flapping='0', notify_service_downtime='0', notify_host_recovery='0', notify_host_down='0', notify_host_unreachable='0', notify_host_flapping='0', notify_host_downtime='0', minimum_importance='0' ON DUPLICATE KEY UPDATE instance_id='1', config_type='1', contact_object_id='60', alias='admin', email_address='danhanwen@sinoicity\.com', pager_address='', host_timeperiod_object_id='55', service_timeperiod_object_id='55', host_notifications_enabled='1', service_notifications_enabled='1', can_submit_commands='1', notify_service_recovery='0', notify_service_warning='0', notify_service_unknown='0', notify_service_critical='0', notify_service_flapping='0', notify_service_downtime='0', notify_host_recovery='0', notify_host_down='0', notify_host_unreachable='0', notify_host_flapping='0', notify_host_downtime='0', minimum_importance='0''

Apr  9 09:29:17 localhost ndo2db: mysql_error: 'Unknown column 'minimum_importance' in 'field list''

解决办法:

         连接至数据库

         use centreon_status;

         alter table nagios_contacts add minimum_importance int(11)  not Null Default 0;

         INSERT INTO nagios_contacts SET instance_id='1', config_type='1', contact_object_id='60', alias='admin', email_address='danhanwen@sinoicity\.com', pager_address='', host_timeperiod_object_id='55', service_timeperiod_object_id='55', host_notifications_enabled='1', service_notifications_enabled='1', can_submit_commands='1', notify_service_recovery='0', notify_service_warning='0', notify_service_unknown='0', notify_service_critical='0', notify_service_flapping='0', notify_service_downtime='0', notify_host_recovery='0', notify_host_down='0', notify_host_unreachable='0', notify_host_flapping='0', notify_host_downtime='0', minimum_importance='0' 


  建议将数据库错误排除后,导出一份正确的数据库文件,再次安装的时候直接通过mysqldump初始化数据库。

本文出自 “不莱梅乐队” 博客,谢绝转载!

你可能感兴趣的:(处理,centreon,日志error)