check_snmpv3: cannot execute binary file

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.
pratik.patel
Posts: 77
Joined: Wed Apr 19, 2017 10:51 am

Re: check_snmpv3: cannot execute binary file

Post by pratik.patel »

How to re-compile check_snmp3 (which I moved from 64-bit machine) ?
Is it possible without doing above stuff you mention?

And if follow above steps does it will affect the nagios or any other services?

also find the more details about the issue:
32-bit-------------
[root@xxxxxxx01 ~]# /usr/lib/nagios/plugins/check_snmp -V
check_snmp v1.4.15 (nagios-plugins 1.4.15)

(this version does not have "-x" option that's the reason I want to use check_snmpv3, which is working fine on 64-bit machine with -x option)

[root@xxxxxxx01 ~]#
[root@xxxxxxx01 ~]# /usr/lib/nagios/plugins/check_snmpv3 -V
-bash: /usr/lib/nagios/plugins/check_snmpv3: cannot execute binary file

64-bit-------------
[root@xxxxxxx04 ~]# /usr/local/nagios/libexec/check_snmpv3 -V
check_snmp v2.2.0 (nagios-plugins 2.2.0)
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: check_snmpv3: cannot execute binary file

Post by dwhitfield »

You'll need to take off the .txt and add the v3, but this is out check_snmp that was built for 32-bit. Please let us know if you have any problems.
Attachments
check_snmp.txt
compiled for 32-bit
(204.86 KiB) Downloaded 242 times
pratik.patel
Posts: 77
Joined: Wed Apr 19, 2017 10:51 am

Re: check_snmpv3: cannot execute binary file

Post by pratik.patel »

How did you re-compile that file for 32-bit?
Or is it different file you got?

And if I follow the steps you mention in previous post, will it effect the nagios or any other services?

Could you please let me know the steps so that I can preform steps to re-compile in future?
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: check_snmpv3: cannot execute binary file

Post by dwhitfield »

I've given you the steps for compiling. The file I gave you was already compiled for 32-bit so you do not need to recompile it.

It seems like maybe we do not mean the same things when we say compile. This is what I'm talking about: https://en.m.wikipedia.org/wiki/Compiler
pratik.patel
Posts: 77
Joined: Wed Apr 19, 2017 10:51 am

Re: check_snmpv3: cannot execute binary file

Post by pratik.patel »

Thank you.

but I am not getting how to perform the task you did.

Could you please explain in details how to re-compile file:
for example I have check_snmpv3 (64-bit) file under /tmp directory and I want to covert that executable file to run on 32-bit machine.

Thanks,
Pratik
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: check_snmpv3: cannot execute binary file

Post by dwhitfield »

When you compile, you use source code. Here are the instructions for compiling our plugins on CentOS 5:

Code: Select all

yum install -y gcc glibc glibc-common make gettext automake wget openssl-devel net-snmp net-snmp-utils epel-release
yum install -y perl-Net-SNMP
cd /tmp
wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.60.tar.gz
tar xzf autoconf-2.60.tar.gz
cd /tmp/autoconf-2.60
./configure
make
make install
cd /tmp
wget --no-check-certificate -O nagios-plugins.tar.gz https://github.com/nagios-plugins/nagios-plugins/archive/release-2.2.0.tar.gz
tar zxf nagios-plugins.tar.gz
cd /tmp/nagios-plugins-release-2.2.0/
./tools/setup
./configure
make
make install
On CentOS 5, you actually need to compile autoconf first. You may already have autoconf installed. If that's the case, then you can skip that step, assuming it's a compatible version. The step that includes github is actually the first step in the compile, but for some plugins you will need the prerequisites listed in the first two steps. Again, it's possible you already have these and you can skip the prerequisites, but I have included them for completeness.
pratik.patel
Posts: 77
Joined: Wed Apr 19, 2017 10:51 am

Re: check_snmpv3: cannot execute binary file

Post by pratik.patel »

From the steps you provided. I am assuming that it will download all the new nagios plugins and do the compile and all.
My question is if I give you one file like I gave check_snmpv3 file yesterday, how will you carry out the process to convert that single file into 32-bit executable file ?

my question is simple and looking to your steps makes it complicated.

Thanks,
Pratik.
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: check_snmpv3: cannot execute binary file

Post by dwhitfield »

dwhitfield wrote:The file I gave you was already compiled for 32-bit so you do not need to recompile it.
I am not sure what else to tell you. I gave you a file and you keep asking how to compile. You can test that the file I have given you is 32-bit using readelf -h /path/to/file

For clarity, you should do the same thing you did initially. Copy the file I have given you to the location you would like, and use it. If you want it to be called check_snmpv3 then you will need to rename it. You can use rename or mv depending on your preference (or perhaps you have a GUI installed and can use that to rename).
pratik.patel
Posts: 77
Joined: Wed Apr 19, 2017 10:51 am

Re: check_snmpv3: cannot execute binary file

Post by pratik.patel »

I know that the file you gave me was 32-bit.
my question is how did you recompiled the file I gave you (64-bit) to 32-bit.

My question is simple because I will have the same problem when I move few other files (64-bit).
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: check_snmpv3: cannot execute binary file

Post by dwhitfield »

You compile from source, not from a previous binary. I have given you instructions for doing this. If you want to compile on a 64-bit machine for 32-bit, then you will need to do so in compatibility mode (although I did not recommend this): http://stackoverflow.com/questions/1272 ... -gcc-cmake

If you want to move compiled files, you need to move then from a 32-bit system (or compile for 32 on 64). You cannot move a 64-bit file to a 32-bit system.

If the plugins are text files rather than compiled, then you can just move the files from 64-bit to 32-bit. As we have 4192 plugins on our exchange, and there are many others on github and other sites, it's impossible to give you a list of which ones are compiled and which are not. You just need to open the plugin up in a text editor. If it looks like garbage, then it's compiled (or perhaps encrypted).
Last edited by dwhitfield on Thu May 11, 2017 11:38 am, edited 1 time in total.
Reason: move vs moved
Locked