I discovered that the nagmq pub socket emits a empty message part after each message part. See sample output below (subtest.py attached).
$ ./subtest.py
2013-10-07 11:20:24.282930
MSG
PART= program_status
PART=
PART= { "type": "program_status", "program_start": 1381158525, "pid": 24267, "daemon_mode": 1, "last_command_check": 1381159225, "last_log_rotation": 0, "notifications_enabled": false, "active_service_checks_enabled": true, "passive_service_checks_enabled": true, "active_host_checks_enabled": true, "passive_host_checks_enabled": true, "event_handlers_enabled": true, "flap_detection_enabled": true, "failure_prediction_enabled": true, "process_performance_data": false, "obsess_over_hosts": false, "obsess_over_services": false, "timestamp": { "tv_sec": 1381159227, "tv_usec": 125901 } }
MSG
PART= program_status
PART=
PART= { "type": "program_status", "program_start": 1381158525, "pid": 24267, "daemon_mode": 1, "last_command_check": 1381159230, "last_log_rotation": 0, "notifications_enabled": false, "active_service_checks_enabled": true, "passive_service_checks_enabled": true, "active_host_checks_enabled": true, "passive_host_checks_enabled": true, "event_handlers_enabled": true, "flap_detection_enabled": true, "failure_prediction_enabled": true, "process_performance_data": false, "obsess_over_hosts": false, "obsess_over_services": false, "timestamp": { "tv_sec": 1381159230, "tv_usec": 158871 } }
By changing nagmq_pub.c this is corrected. See my changeset on github:
Output with bugfix:
$ ./subtest.py
2013-10-07 11:20:04.348818
MSG
PART= program_status
PART= { "type": "program_status", "program_start": 1379599569, "pid": 27272, "daemon_mode": 1, "last_command_check": 1381159202, "last_log_rotation": 1380600000, "notifications_enabled": true, "active_service_checks_enabled": true, "passive_service_checks_enabled": true, "active_host_checks_enabled": true, "passive_host_checks_enabled": true, "event_handlers_enabled": true, "flap_detection_enabled": true, "failure_prediction_enabled": true, "process_performance_data": false, "obsess_over_hosts": false, "obsess_over_services": false, "timestamp": { "tv_sec": 1381159206, "tv_usec": 146632 } }
[aj316@fennel:~/nagios/nagmq]$ ./subtest.py
2013-10-07 11:20:10.133130
MSG
PART= program_status
PART= { "type": "program_status", "program_start": 1379599569, "pid": 27272, "daemon_mode": 1, "last_command_check": 1381159207, "last_log_rotation": 1380600000, "notifications_enabled": true, "active_service_checks_enabled": true, "passive_service_checks_enabled": true, "active_host_checks_enabled": true, "passive_host_checks_enabled": true, "event_handlers_enabled": true, "flap_detection_enabled": true, "failure_prediction_enabled": true, "process_performance_data": false, "obsess_over_hosts": false, "obsess_over_services": false, "timestamp": { "tv_sec": 1381159212, "tv_usec": 194705 } }
Is the empty message part intentional?
Tony