Home » Categories » Multiple Categories

Nagios XI - Uploaded plugin returns "/bin/bash^M: bad interpreter: No such file or directory"

Problem Description

After uploading a plugin (check_apc_pdu_load.sh for example), the following error is produced:

The following error message is produced:

-bash: ./check_apc_pdu_load.sh: /bin/bash^M: bad interpreter: No such file or directory

This is caused by the file being in a "Windows" format instead of a "Unix" format. It has to do with the line endings / carriage returns.

 

Resolving The Problem

To resolve the problem you will convert the file to a Unix format. Execute the following steps from an SSH session as a user with root privileges.

The first step is to install the required package:

RHEL | CentOS | Oracle Linux

yum install -y dos2unix

 

Debian | Ubuntu

apt-get install -y dos2unix

 

The next step is to convert the file to a Unix format:

dos2unix /usr/local/nagios/libexec/check_apc_pdu_load.sh


This will output:

dos2unix: converting file /usr/local/nagios/libexec/check_apc_pdu_load.sh to UNIX format ...

 

After completing these steps the plugin should execute as intended.

 

 

Final Thoughts

For any support related questions please visit the Nagios Support Forums at:

http://support.nagios.com/forum/

0 (0)
Article Rating (No Votes)
Rate this article
  • Icon PDFExport to PDF
  • Icon MS-WordExport to MS Word
Attachments Attachments
There are no attachments for this article.
Related Articles RSS Feed
Nagios XI - Downloading A System Profile
Viewed 4388 times since Wed, Jul 19, 2017
Nagios XI - Modifying The Contents Of /usr/local/nagios/etc
Viewed 3977 times since Tue, Jan 26, 2016
Nagios XI - NSP: Sorry Dave, I can’t let you do that
Viewed 19032 times since Tue, Jan 27, 2015
Nagios XI - Debugging Bandwidth Performance Graphs
Viewed 10581 times since Tue, Jan 27, 2015
Nagios XI - Last Check Time Not Updating
Viewed 13817 times since Tue, Jan 6, 2015
Nagios XI - ERROR: unable to open include file: conf.d/*.cfg
Viewed 3930 times since Sun, May 29, 2016
Nagios XI - Apply Configuration Never Completes
Viewed 17785 times since Tue, Jan 27, 2015
Slack Notifications Stopped Working
Viewed 2984 times since Wed, Mar 18, 2020
Nagios XI - Installing Latest SourceGuardian Loaders
Viewed 4282 times since Mon, Jun 18, 2018
Nagios XI - MRTG Reports SNMP_Session Errors
Viewed 3194 times since Wed, Jul 27, 2016