Hello,
I inherited a Nagios project and I need to make changes and re-compile a customized Nagios plugin. How do I compile a single plugin. This is on a Linux machine and when I run the plugin -v it says (nagios-plugins 1.4) I looked at the plugin development html, but it didn’t seem to answer my question.
Thanks,
cd to dir containing the check_ups.c file
type
make check_ups
I tried as you said below and it give a bunch of errors. I also noticed if I take one of the current nagios plugins, do make file it works. If I change the file name and do make newfile it gets the same errors as my new plugin.
Errors:
make check_panacim_service
gcc -g -O2 -I/usr/kerberos/include -L. -L/usr/lib check_panacim_service.c -o check_panacim_service
In file included from check_panacim_service.c:26:
common.h:35:20: config.h: No such file or directory
In file included from check_panacim_service.c:26:
common.h:146: syntax error before "va_list"
common.h:187:21: gettext.h: No such file or directory
In file included from check_panacim_service.c:27:
netutils.h:35:20: config.h: No such file or directory
In file included from check_panacim_service.c:27:
netutils.h:39: syntax error before "socket_timeout_alarm_handler"
netutils.h:39: warning: data definition has no type or storage class In file included from check_panacim_service.c:28:
utils.h:30: syntax error before "timeout_alarm_handler"
utils.h:30: warning: data definition has no type or storage class
utils.h:53: redefinition of struct timeval' utils.h:60: warning:
struct timezone’ declared inside parameter list
utils.h:60: warning: its scope is only this definition or declaration, which is probably not what you want In file included from check_panacim_service.c:29:
popen.h:9: syntax error before "popen_timeout_alarm_handler"
popen.h:9: warning: data definition has no type or storage class
check_panacim_service.c: In function main': check_panacim_service.c:45: warning: initialization makes pointer from integer without a cast check_panacim_service.c:52: warning: assignment makes pointer from integer without a cast check_panacim_service.c:53: warning: assignment makes pointer from integer without a cast check_panacim_service.c:55:
LC_ALL’ undeclared (first use in this function)
check_panacim_service.c:55: (Each undeclared identifier is reported only once
check_panacim_service.c:55: for each function it appears in.)
check_panacim_service.c:56: PACKAGE' undeclared (first use in this function) check_panacim_service.c:56:
LOCALEDIR’ undeclared (first use in this function)
check_panacim_service.c:60: warning: passing arg 1 of usage4' makes pointer from integer without a cast check_panacim_service.c:79: warning: passing arg 1 of
printf’ makes pointer from integer without a cast
check_panacim_service.c:87: warning: passing arg 1 of printf' makes pointer from integer without a cast check_panacim_service.c:129: warning: assignment makes pointer from integer without a cast check_panacim_service.c:130: warning: assignment makes pointer from integer without a cast check_panacim_service.c:135: warning: assignment makes pointer from integer without a cast check_panacim_service.c: In function
print_help’:
check_panacim_service.c:157: warning: passing arg 1 of printf' makes pointer from integer without a cast check_panacim_service.c:162: warning: passing arg 1 of
printf’ makes pointer from integer without a cast
check_panacim_service.c:164: warning: passing arg 1 of `printf’ makes pointer from integer without a cast
make: *** [check_panacim_service] Error 1
Try make check_ups or make check_ping. If it works, then it’s your custom plugin’s problem so rewrite the code. I’m no programmer at all, but I do know, that “make check_ups” does work.
I tried “make check_ups”. That does work. Then I did “cp check_ups.c check_ups1.c” and then “make check_ups1” and it gives the same errors my custom plugin gets.
That is due to the code is looking for check_ups.c and not check_ups1.c for a file name is my guess.