Plugin Uploads over WebUI are "DOS" CR+LF formatted

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
JessieBryan
Posts: 10
Joined: Thu May 16, 2013 12:38 pm

Plugin Uploads over WebUI are "DOS" CR+LF formatted

Post by JessieBryan »

Hey guys,

I thought I would let others know what I stumbled on, while evaluating NagiosXI 2012R2.2. While using the NagiosXI web interface, there is an area that allows you to upload plugins. If you use this vs. FTP/SSH the file becomes "DOS" CR+LF formatted even if the source-file is UNIX LF formatted.

I filed the bug (#419) - this Forum post is just an FYI incase others wonder why their plugins aren't working when uploaded over the Web UI. I had to manually change the files to LF format (dos2unix or similar)

Tested with Firefox on OSX and Linux


The details can be found here: http://tracker.nagios.com/view.php?id=419
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: Plugin Uploads over WebUI are "DOS" CR+LF formatted

Post by sreinhardt »

I just tested this, as this is the first report I have heard, and do not have the same issues. Are you pasting the contents of files into notepad or another windows file editor prior to uploading? Have you verified the file you started with is in fact unix line endings?
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
JessieBryan
Posts: 10
Joined: Thu May 16, 2013 12:38 pm

Re: Plugin Uploads over WebUI are "DOS" CR+LF formatted

Post by JessieBryan »

sreinhardt wrote:I just tested this, as this is the first report I have heard, and do not have the same issues. Are you pasting the contents of files into notepad or another windows file editor prior to uploading? Have you verified the file you started with is in fact unix line endings?
Hello,

I'm actually working with a nagios migration, I scp'ed existing scripts to my linux desktop, opened my browser and uploaded them as previously described. The files before upload are properly formatted, and will run. If I look at the file uploaded files on the CLI of the NagiosXI box, they will not run unless I run "dos2unix". Multiple admins here have tested this from different OS/Browsers and got the same problem. One admin suggested it could be an Apache config.


CentOS release 6.4 (Final)
httpd-2.2.15-28.el6.centos.x86_64
NagiosXI was installed via the auto installer tarball.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Plugin Uploads over WebUI are "DOS" CR+LF formatted

Post by Box293 »

Hi JessieBryan,
I may have come across a similar problem with another product in the past.

In my case, when using WinSCP, make sure WinSCP is configured to transfer files in text mode. If this is not correct it will add ^M to the end of each line of every file you transfer which will cause problems. I believe your problem is being caused when you SCP the files from your original location.

I hope this is of some help.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Plugin Uploads over WebUI are "DOS" CR+LF formatted

Post by scottwilkerson »

Yep. It can screw up the shebang line (among other things..)
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
JessieBryan
Posts: 10
Joined: Thu May 16, 2013 12:38 pm

Re: Plugin Uploads over WebUI are "DOS" CR+LF formatted

Post by JessieBryan »

Hi guys,

In case everyone doesn't have access to the bug tracker, I thought I'd post some additional info here:


* A file on my desktop (OSX) is written in Unix (LF) format
* I upload the file using NagiosXI Web Gui "check_temp.py"
* The uploaded file on nagiosxi server is now in DOS (CR+LF) mode



We have reproduced this using Windows 7/Firefox, and OSX/Safari
JessieBryan
Posts: 10
Joined: Thu May 16, 2013 12:38 pm

Re: Plugin Uploads over WebUI are "DOS" CR+LF formatted

Post by JessieBryan »

# Desktop
#
[jbryan@laptop Downloads]$ file check_temp.py
script text executablein/python


* go upload the check_temp.py file via NagiosXI Gui...
* SSH into NagiosXI server and review the results from the upload:

# NagiosXI Server
#
[nagios@monitor libexec]$ file check_temp.py
check_temp.py: a /usr/bin/python\015 script text executable

[nagios@monitor libexec]$ dos2unix check_temp.py
dos2unix: converting file check_temp.py to UNIX format ...

[nagios@monitor libexec]$ file check_temp.py
check_temp.py: a /usr/bin/python script text executable
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Plugin Uploads over WebUI are "DOS" CR+LF formatted

Post by abrist »

I just tested a few different environment with a few different browsers each and could not reproduce the problem. Are you experiencing this problem with just scripts that you wrote on your mac, or have you tried to upload a script from the exchange as well?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Locked