Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
I download the "check_mem.pl" from 'exchange.nagios.org' or the link https://raw.githubusercontent.com/justi ... eck_mem.pl. This plugin is to check the available memory (RAM) of the host. I copied this perl script to my library plugin folder "/usr/lib/nagios/plugins/" and added execute rights to the file.
Then checked it manually and got the expected results. the only issue was that the results were shown in KB and i wanted it to display it in MB. I did some changes (which were useless as i dont have any knowledge of perl) and then some time later i stopped getting output completely.
I knew i messed up so i again replaced the messed up perl script with the original code from link above. But it didnt work. I tried this on different nagios instance with original script but strangely i got the same error on that instance as well. Please check the code below and suggest whats going wrong.
ubuntu@ip-XXX-XX-X-XX:/etc/nagios3/conf.d$ /usr/lib/nagios/plugins/check_mem.pl -w 10 -c 5 -f -C
/usr/lib/nagios/plugins/check_mem.pl: line 1: #!/usr/bin/perl: No such file or directory
/usr/lib/nagios/plugins/check_mem.pl: line 2: $'\r': command not found
/usr/lib/nagios/plugins/check_mem.pl: line 10: $'\r': command not found
/usr/lib/nagios/plugins/check_mem.pl: line 16: $'\r': command not found
/usr/lib/nagios/plugins/check_mem.pl: line 19: $'\r': command not found
/usr/lib/nagios/plugins/check_mem.pl: line 26: $'\r': command not found
/usr/lib/nagios/plugins/check_mem.pl: line 28: use: command not found
/usr/lib/nagios/plugins/check_mem.pl: line 28: $'\r': command not found
/usr/lib/nagios/plugins/check_mem.pl: line 29: use: command not found
/usr/lib/nagios/plugins/check_mem.pl: line 29: $'\r': command not found
/usr/lib/nagios/plugins/check_mem.pl: line 30: $'\r': command not found
/usr/lib/nagios/plugins/check_mem.pl: line 33: $'\r': command not found
/usr/lib/nagios/plugins/check_mem.pl: line 35: syntax error near unexpected token `('
'usr/lib/nagios/plugins/check_mem.pl: line 35: `use vars qw($opt_c $opt_f $opt_u $opt_w $opt_C $opt_v %exit_codes);
I download the "check_mem.pl" from 'exchange.nagios.org' or the link https://raw.githubusercontent.com/justi ... eck_mem.pl. This plugin is to check the available memory (RAM) of the host. I copied this perl script to my library plugin folder "/usr/lib/nagios/plugins/" and added execute rights to the file.
Then checked it manually and got the expected results. the only issue was that the results were shown in KB and i wanted it to display it in MB. I did some changes (which were useless as i dont have any knowledge of perl) and then some time later i stopped getting output completely.
I knew i messed up so i again replaced the messed up perl script with the original code from link above. But it didnt work. I tried this on different nagios instance with original script but strangely i got the same error on that instance as well. Please check the code below and suggest whats going wrong.
ubuntu@ip-XXX-XX-X-XX:/etc/nagios3/conf.d$ /usr/lib/nagios/plugins/check_mem.pl -w 10 -c 5 -f -C
/usr/lib/nagios/plugins/check_mem.pl: line 1: #!/usr/bin/perl: No such file or directory
/usr/lib/nagios/plugins/check_mem.pl: line 2: $'\r': command not found
/usr/lib/nagios/plugins/check_mem.pl: line 10: $'\r': command not found
/usr/lib/nagios/plugins/check_mem.pl: line 16: $'\r': command not found
/usr/lib/nagios/plugins/check_mem.pl: line 19: $'\r': command not found
/usr/lib/nagios/plugins/check_mem.pl: line 26: $'\r': command not found
/usr/lib/nagios/plugins/check_mem.pl: line 28: use: command not found
/usr/lib/nagios/plugins/check_mem.pl: line 28: $'\r': command not found
/usr/lib/nagios/plugins/check_mem.pl: line 29: use: command not found
/usr/lib/nagios/plugins/check_mem.pl: line 29: $'\r': command not found
/usr/lib/nagios/plugins/check_mem.pl: line 30: $'\r': command not found
/usr/lib/nagios/plugins/check_mem.pl: line 33: $'\r': command not found
/usr/lib/nagios/plugins/check_mem.pl: line 35: syntax error near unexpected token `('
'usr/lib/nagios/plugins/check_mem.pl: line 35: `use vars qw($opt_c $opt_f $opt_u $opt_w $opt_C $opt_v %exit_codes);
What does the output of a ls -l /usr/bin | grep perl command look like?
Can you post the contents of the plugin, as it is on your server (preferably without your modifications ) in code brackets here?