Page 1 of 1

Adding a cgi file to nagios

Posted: Fri Mar 08, 2013 6:50 am
by rakesh514
Hello,
I want to add a cgi file to Nagios. I wrote a C program referring the other programs I found inside /cgi folder and kept it in the same location. I modified Makefile.in (added lines for my cgi file) and then configured and compiled using make all (according to nagios installation guides). But I am getting the following error.
(jobs.c is my file)

[root@localhost nagios-3.2.3]# make all
cd ./base && make
make[1]: Entering directory `/root/downloads/nagios-3.2.3/base'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/root/downloads/nagios-3.2.3/base'
cd ./cgi && make
make[1]: Entering directory `/root/downloads/nagios-3.2.3/cgi'
make[1]: *** No rule to make target `gcc', needed by `jobs.cgi'. Stop.
make[1]: Leaving directory `/root/downloads/nagios-3.2.3/cgi'
make: *** [all] Error 2

Do I need to make changes elsewhere? Please help.

Re: Adding a cgi file to nagios

Posted: Fri Mar 08, 2013 11:52 am
by abrist
Can you post your makefile in code wraps?

Re: Adding a cgi file to nagios

Posted: Sat Mar 09, 2013 1:38 am
by rakesh514
I made the following two changes to cgi/Makefile.in (before I configured and compiled according to http://nagios.sourceforge.net/docs/3_0/ ... edora.html)

1) I included 'jobs.cgi' in the below line.
CGIS=avail.cgi cmd.cgi config.cgi extinfo.cgi history.cgi notifications.cgi jobs.cgi outages.cgi showlog.cgi status.cgi statuswml.cgi summary.cgi tac.cgi $(CGIEXTRAS)

2) And in the following portion, I added an entry for jobs.cgi.
########## CGIS ##########
notifications.cgi: notifications.c $(CGIDEPS)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ notifications.c $(CGILIBS) $(LIBS)

jobs.cgi: jobs.c $(CGIDEPS)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ jobs.c $(CGILIBS) $(LIBS)

outages.cgi: outages.c $(CGIDEPS) $(CDATADEPS)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ outages.c $(CGILIBS) $(CDATALIBS) $(LIBS)


What other modifications I need to do? For testing, I have included the same code of notifications.c in jobs.c inside cgi/
When I compile using make all, I get the error.


Thanks and regards,
Rakesh

Re: Adding a cgi file to nagios

Posted: Mon Mar 11, 2013 9:42 am
by abrist
Makefiles have a *very* strict syntax. Could you post the full file?