VMware Cloud Community
dmg136
Contributor
Contributor

Problem building Apache 2.0 SNMP module

I am using HypericHQ 2.7.4 and trying to build the SNMP module for Apache 2.0. The build script errors out on line 146 while trying to run 'srclib/sdbm/configure'. A quick check of the sdbm folder reveals that the configure script is missing. I checked the snmp-1.0.1.tar.gz archive and it does not contain 'srclib/sdbm/configure'. Is there somewhrere I can download the missing configure file? Thanks.
0 Kudos
11 Replies
almery
Contributor
Contributor

I ran into the same problem. Although I was able to move beyond it by running the build_apache_snmp.sh script with a '-r' (which regenerates the configure scripts and makefiles according to the comments), I still am only able to get the apache 2.0 snmp module working on 1 of 3 hosts.

On the two it isn't working on, I've been able to get a clean build with no errors in the log files after some amount of effort. However, in one case (on the 64 bit machine) although it seems to be installed correctly, and the /etc/httpd/var directory exists with what seem to be the right permissions, I get a syntax error when trying to start apache: Starting httpd: Syntax error on line 1376 of /etc/httpd/conf/httpd.conf: Unable to write to SNMPvar directory. The line in question is: SNMPVar var, as described in the docs.

On the other machine that I can't get to work (32 bit), I get much farther, even to the point that apache starts fine and the test (snmp_module_2.0/tools/snmpwalk -p 1610 -M snmp_module_2.0/mibs 127.0.0.1 public) returns a lot of data. However, the "Availablity" indicator is red for apache 2.0.52 for that host on the resource hub (http://localhost:7080/ResourceHub.do?ff=2).

Both machines are CentOS release 4.3 (Final).

Any advice would be appreciated.

Thanks,
Jay
0 Kudos
john_hyperic
Hot Shot
Hot Shot

The problem on your 64-bit machine with the var directory error is
likely because the var directory is not what you think it is. By
specifying the config of "SNMPvar var", that should put the var
directory in ServerRoot. Best thing to do would be to take away all
question by specifying ully qualified path like so:

SNMPvar /etc/httpd/var

Make sure the directory is writable by the user Apache runs as.

The second problem is most likely due to misconfiguration either on the
HQ side or in Apache. Need to make sure that each vhost (including the
main server which is considered it's own vhost) have the ServerName
configured with hostname:port format. Then, in HQ the same hostname
from the previous config needs to be in the Apache server config as the
"server.name" and the port obviously needs to be configured as the port.

If it is ONLY the Availability metric that is the problem (i.e. you are
getting other metrics), then check that the "path" configuration on the
Apache server in HQ is GETable. It defaults to "/", if for any reason
the / URI on your Apache does not return a 200 result, you will get
unavailable.

If you still can't figure it out, check out the following URL to see how
to invoke the Apache plugin from the command line and run auto-discovery
and metric collection from the command line to see if you can figure out
why it's failing.

http://support.hyperic.com/confluence/display/DOCSHQ27/Invoking+Plugins+Standalone

0 Kudos
joje1109
Contributor
Contributor

I tried the suggestion but I now get the following error:

building sdbm
building libsmi
building ucd-snmp
./configure[3939]: shared: not found
building Apache module
cannot open /u/webs/ap-home/build/config_vars.mk: No such file or directory at /u/webs/ap-home/bin/apxs line 218.
cannot open /u/webs/ap-home/build/config_vars.mk: No such file or directory at /u/webs/ap-home/bin/apxs line 218.
cannot open /u/webs/ap-home/build/config_vars.mk: No such file or directory at /u/webs/ap-home/bin/apxs line 218.
cannot open /u/webs/ap-home/build/config_vars.mk: A file or directory in the path name does not exist. at /u/webs/ap-home/bin/apxs line 218.
usage: remake_http_protocol <apache-src-dir> at src/www-mib/remake_http_protocol line 3.
Build failed. Please email /tmp/snmp-1.0.1/2.0_log to support

Thanks for the help!!!

JJ
0 Kudos
john_hyperic
Hot Shot
Hot Shot

What Apache is this? Looks like maybe a pre-installed Apache in some
Linux distribution? You probably need to install your distribution's
equivalent of apache-devel. The problem is that you are missing files
required to run apxs, namely config_vars.mk. In order to build the
module, you need to have a working apxs.

I suggest one of two solutions:
1. Install the apache-devel equivalent for your Linux distribution.
2. Build and install your own Apache.

Actually, there is a third option if you really want to use that Apache.
You can build and install an Apache with the identical version of the
one you are currently trying. Build the module against that Apache and
then you can install the modules on the first Apache and use them with
that one. You only need apxs to build the modules, its not necessary to
run with them.

0 Kudos
joje1109
Contributor
Contributor

Custom built and running on AIX 5L...we are an AIX shop so if the product is not compatible we cannt use it....
0 Kudos
joje1109
Contributor
Contributor

I will try ther 3rd suggestion....
0 Kudos
PaulPeterson
Contributor
Contributor

This is one of the big reasons I wanted to used server-status to scrape stats from apache. The snmp module in our packaged redhat apache deployment was not possible.
0 Kudos
almery
Contributor
Contributor

> The problem on your 64-bit machine with the var
> directory error is
> likely because the var directory is not what you
> think it is. By
> specifying the config of "SNMPvar var", that should
> put the var
> directory in ServerRoot. Best thing to do would be
> to take away all
> question by specifying ully qualified path like so:
>
> SNMPvar /etc/httpd/var
> sure the directory is writable by the user Apache
> runs as.

I tried specifying the fully qualified path, with no luck. However, when I changed SNMPVar to /tmp, apache started up and wrote a bunch of wwwbucket.* files, so that hurdle is past. (although I'm still not sure what's wrong with /etc/httpd/var)

However, the snmpwalk test times out, and I'm seeing this line in my error_log:
[Wed Oct 11 14:41:58 2006] [error] SNMP: CovalentSNMP/2.3.0 (SNMP) could not be started init_master_agent: Invalid local port (Permission denied)

Any idea which port it's complaining about and/or what to do about it?

> The second problem is most likely due to
> misconfiguration either on the
> HQ side or in Apache.
> If it is ONLY the Availability metric that is the
> problem (i.e. you are
> getting other metrics), then check that the "path"
> configuration on the
> Apache server in HQ is GETable. It defaults to "/",
> if for any reason
> the / URI on your Apache does not return a 200
> result, you will get
> unavailable.

Yep, you hit the nail on the head with this one.

Thanks!
Jay
0 Kudos
john_hyperic
Hot Shot
Hot Shot

The problem with /etc/httpd/var is likely that some level (/etc,
/etc/httpd or /etc/httpd/var) is not writable by the user Apache is
running as.

The port is the snmp port configured in snmpd.conf. If it is 161, that
is a privileged port and only root will be allowed to open that port.
Best thing to do is set it to some high port (1610 is usually good).

By the way, that snmpd.conf file needs to exist in the SNMPconf
directory. Which may be having the same problems your SNMPvar setting
is having. Maybe the best thing to do as a temporary solution until you
can get your permissions problems sorted out, is to put snmpd.conf in
/tmp. Then set "SNMPconf /tmp" and "SNMPvar /tmp". That way you can at
least see it working.

0 Kudos
almery
Contributor
Contributor

> The problem with /etc/httpd/var is likely that some
> level (/etc,
> /etc/httpd or /etc/httpd/var) is not writable by the
> user Apache is
> running as.

I checked the perms of these directories, and they are exactly the same as the other machines where the snmp module is working.

> The port is the snmp port configured in snmpd.conf.
> If it is 161, that
> s a privileged port and only root will be allowed to
> open that port.
> Best thing to do is set it to some high port (1610 is
> usually good).

It's set to 1610 in snmp.conf, but I suspect it may not be reading that file.

> By the way, that snmpd.conf file needs to exist in
> the SNMPconf
> directory. Which may be having the same problems
> your SNMPvar setting
> is having. Maybe the best thing to do as a temporary
> solution until you
> can get your permissions problems sorted out, is to
> put snmpd.conf in
> /tmp. Then set "SNMPconf /tmp" and "SNMPvar /tmp".
> That way you can at
> east see it working.

Yes, I had figured as much and tried that as well, to no avail.

Is there any way I can turn on additional debugging info?

Thanks,
Jay
0 Kudos
almery
Contributor
Contributor

It turns out the permission problems were all due to selinux. Once I did a setenforce 0, the problem disappeared completely.

Thanks for all the help and good suggestions!
0 Kudos