Nagios Core Main Config editor removes line-breaks!

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
User avatar
chrisp
Posts: 71
Joined: Fri Dec 28, 2012 11:35 am

Nagios Core Main Config editor removes line-breaks!

Post by chrisp »

Hi,

We've just discovered that if you use the "Nagios Core Main Config" editor (https://nagios/nagiosxi//includes/compo ... pe=corecfg) within the Nagios XI GUI, when you save the file, it removes all line-breaks and Nagios config checks fail (obviously).

We've seen/tested this in Chrome and Firefox.

Actually, I've done a bit more digging and it's also happening on "Nagios Core CGI Config" editor (https://nagios/nagiosxi//includes/compo ... ype=cgicfg) and further to my initial findings, it's not that line-breaks are removed, but that the resulting file contents are "over escaped" (made-up term), with there being a single line of text, containing escape sequences for newline (\n), carriage return (\r), tab (\t), instead of the actual elements.

Code: Select all

# MODIFIED\r\nadmin_email=root@localhost\r\nadmin_pager=root@localhost\r\ntranslate_passive_host_checks=1\r\nlog_event_handlers=0\r\nuse_large_installation_tweaks=1\r\nenable_environment_macros=0\r\n\r\n\r\n# NDOUtils module\r\nbroker_module=/usr/local/nagios/bin/ndomod.o config_file=/usr/local/nagios/etc/ndomod.cfg\r\n\r\n\r\n# PNP settings - bulk mode with NCPD\r\nprocess_performance_data=1\r\n# service performance data\r\nservice_perfdata_file=/usr/local/nagios/var/service-perfdata\r\nservice_perfdata_file_template=DATATYPE::SERVICEPERFDATA\\tTIMET::$TIMET$\\tHOSTNAME::$HOSTNAME$\\tSERVICEDESC::$SERVICEDESC$\\tSERVICEPERFDATA::$SERVICEPERFDATA$\\tSERVICECHECKCOMMAND::$SERVICECHECKCOMMAND$\\tHOSTSTATE::$HOSTSTATE$\\tHOSTSTATETYPE::$HOSTSTATETYPE$\\tSERVICESTATE::$SERVICESTATE$\\tSERVICESTATETYPE::$SERVICESTATETYPE$\\tSERVICEOUTPUT::$SERVICEOUTPUT$\r\nservice_perfdata_file_mode=a\r\nservice_perfdata_file_processing_interval=15\r\nservice_perfdata_file_processing_command=process-service-perfdata-file-pnp-bulk\r\n# host performance data\r\nhost_perfdata_file=/usr/local/nagios/var/host-perfdata\r\nhost_perfdata_file_template=DATATYPE::HOSTPERFDATA\\tTIMET::$TIMET$\\tHOSTNAME::$HOSTNAME$\\tHOSTPERFDATA::$HOSTPERFDATA$\\tHOSTCHECKCOMMAND::$HOSTCHECKCOMMAND$\\tHOSTSTATE::$HOSTSTATE$\\tHOSTSTATETYPE::$HOSTSTATETYPE$\\tHOSTOUTPUT::$HOSTOUTPUT$\r\nhost_perfdata_file_mode=a\r\nhost_perfdata_file_processing_interval=15\r\nhost_perfdata_file_processing_command=process-host-perfdata-file-pnp-bulk\r\n\r\n\r\n# OBJECTS - UNMODIFIED\r\n#cfg_file=/usr/local/nagios/etc/objects/commands.cfg\r\n#cfg_file=/usr/local/nagios/etc/objects/contacts.cfg\r\n#cfg_file=/usr/local/nagios/etc/objects/localhost.cfg\r\n#cfg_file=/usr/local/nagios/etc/objects/templates.cfg\r\n#cfg_file=/usr/local/nagios/etc/objects/timeperiods.cfg\r\n\r\n\r\n# STATIC OBJECT DEFINITIONS (THESE DON\'T GET EXPORTED/IMPORTED BY NAGIOSQL)\r\ncfg_dir=/usr/local/nagios/etc/static\r\n\r\n# OBJECTS EXPORTED FROM NAGIOSQL\r\ncfg_file=/usr/local/nagios/etc/contacttemplates.cfg\r\ncfg_file=/usr/local/nagios/etc/contactgroups.cfg\r\ncfg_file=/usr/local/nagios/etc/contacts.cfg\r\ncfg_file=/usr/local/nagios/etc/timeperiods.cfg\r\ncfg_file=/usr/local/nagios/etc/commands.cfg\r\ncfg_file=/usr/local/nagios/etc/hostgroups.cfg\r\ncfg_file=/usr/local/nagios/etc/servicegroups.cfg\r\ncfg_file=/usr/local/nagios/etc/hosttemplates.cfg\r\ncfg_file=/usr/local/nagios/etc/servicetemplates.cfg\r\ncfg_file=/usr/local/nagios/etc/servicedependencies.cfg\r\ncfg_file=/usr/local/nagios/etc/serviceescalations.cfg\r\ncfg_file=/usr/local/nagios/etc/hostdependencies.cfg\r\ncfg_file=/usr/local/nagios/etc/hostescalations.cfg\r\ncfg_file=/usr/local/nagios/etc/hostextinfo.cfg\r\ncfg_file=/usr/local/nagios/etc/serviceextinfo.cfg\r\ncfg_dir=/usr/local/nagios/etc/hosts\r\ncfg_dir=/usr/local/nagios/etc/services\r\n\r\n# GLOBAL EVENT HANDLERS\r\nglobal_host_event_handler=xi_host_event_handler\r\nglobal_service_event_handler=xi_service_event_handler\r\n\r\n\r\n\r\n# UNMODIFIED\r\naccept_passive_host_checks=1\r\naccept_passive_service_checks=1\r\nadditional_freshness_latency=15\r\nauto_reschedule_checks=0\r\nauto_rescheduling_interval=30\r\nauto_rescheduling_window=180\r\nbare_update_check=0\r\ncached_host_check_horizon=15\r\ncached_service_check_horizon=15\r\ncheck_external_commands=1\r\ncheck_for_orphaned_hosts=1\r\ncheck_for_orphaned_services=1\r\ncheck_for_updates=1\r\ncheck_host_freshness=0\r\ncheck_result_path=/usr/local/nagios/var/spool/checkresults\r\ncheck_result_reaper_frequency=10\r\ncheck_service_freshness=1\r\ncommand_check_interval=-1\r\ncommand_file=/usr/local/nagios/var/rw/nagios.cmd\r\ndaemon_dumps_core=0\r\ndate_format=us\r\ndebug_file=/usr/local/nagios/var/nagios.debug\r\ndebug_level=0\r\ndebug_verbosity=1\r\nenable_embedded_perl=1\r\nenable_event_handlers=1\r\nenable_flap_detection=1\r\nenable_notifications=1\r\nenable_predictive_host_dependency_checks=1\r\nenable_predictive_service_dependency_checks=1\r\nevent_broker_options=-1\r\nevent_handler_timeout=30\r\nexecute_host_checks=1\r\nexecute_service_checks=1\r\nexternal_command_buffer_slots=4096\r\nhigh_host_flap_threshold=20.0\r\nhigh_service_flap_threshold=20.0\r\nhost_check_timeout=30\r\nhost_freshness_check_interval=60\r\nhost_inter_check_delay_method=d\r\nillegal_macro_output_chars=`~$&|\'\"<>\r\nillegal_object_name_chars=`~!$%^&*|\'\"<>?,()=\r\ninterval_length=60\r\nlock_file=/usr/local/nagios/var/nagios.lock\r\nlog_archive_path=/usr/local/nagios/var/archives\r\nlog_external_commands=0\r\nlog_file=/usr/local/nagios/var/nagios.log\r\nlog_host_retries=1\r\nlog_initial_states=0\r\nlog_notifications=1\r\nlog_passive_checks=0\r\nlog_rotation_method=d\r\nlog_service_retries=1\r\nlow_host_flap_threshold=5.0\r\nlow_service_flap_threshold=5.0\r\nmax_check_result_file_age=3600\r\nmax_check_result_reaper_time=30\r\nmax_concurrent_checks=0\r\nmax_debug_file_size=1000000\r\nmax_host_check_spread=30\r\nmax_service_check_spread=30\r\nnagios_group=nagios\r\nnagios_user=nagios\r\nnotification_timeout=30\r\nobject_cache_file=/usr/local/nagios/var/objects.cache\r\nobsess_over_hosts=0\r\nobsess_over_services=0\r\nocsp_timeout=5\r\np1_file=/usr/local/nagios/bin/p1.pl\r\npassive_host_checks_are_soft=0\r\nperfdata_timeout=5\r\nprecached_object_file=/usr/local/nagios/var/objects.precache\r\nresource_file=/usr/local/nagios/etc/resource.cfg\r\nretained_contact_host_attribute_mask=0\r\nretained_contact_service_attribute_mask=0\r\nretained_host_attribute_mask=0\r\nretained_process_host_attribute_mask=0\r\nretained_process_service_attribute_mask=0\r\nretained_service_attribute_mask=0\r\nretain_state_information=1\r\nretention_update_interval=60\r\nservice_check_timeout=300\r\nservice_freshness_check_interval=60\r\nservice_inter_check_delay_method=d\r\nservice_interleave_factor=s\r\nsleep_time=0.25\r\nsoft_state_dependencies=0\r\nstate_retention_file=/usr/local/nagios/var/retention.dat\r\nstatus_file=/usr/local/nagios/var/status.dat\r\nstatus_update_interval=10\r\ntemp_file=/usr/local/nagios/var/nagios.tmp\r\ntemp_path=/tmp\r\nuse_aggressive_host_checking=0\r\nuse_embedded_perl_implicitly=1\r\nuse_regexp_matching=0\r\nuse_retained_program_state=1\r\nuse_retained_scheduling_info=1\r\nuse_syslog=1\r\nuse_true_regexp_matching=0\r\n\r\n\r\n
If there's a better place to report such things, please let me know.

Cheers,
--
ChrisP
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: Nagios Core Main Config editor removes line-breaks!

Post by mguthrie »

This works for reporting :)

Thanks for the heads up, we'll take a look at this and posted a fixed revision of the CCM to this thread.
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: Nagios Core Main Config editor removes line-breaks!

Post by mguthrie »

Here's a fixed version of the CCM component. This will ship with the 2012r1.5 release.
You do not have the required permissions to view the files attached to this post.
User avatar
chrisp
Posts: 71
Joined: Fri Dec 28, 2012 11:35 am

Re: Nagios Core Main Config editor removes line-breaks!

Post by chrisp »

I've applied this fix to our platform and tested it out. Works a treat, thanks!
ls4074
Posts: 13
Joined: Thu Feb 20, 2014 7:16 pm

Re: Nagios Core Main Config editor removes line-breaks!

Post by ls4074 »

Hello,

I am having a similar issue. I have a file edited in Unix vi. When I loaded it to Nagios XI via Static Configuration Manager, the carriage returns are all gone. So everything are in one line. I am running 2012R2.9. Any idea? Thanks!
Locked