VMware Cloud Community
anoonan
Contributor
Contributor

Chrooted bind monitoring not working

Hi all,

I'm running bind in a chrooted environment. The Hyperic agent's user has access to the stats file, but I get the error:

Error retrieving value: Stats file <file> does not exist

where file is either the chrooted file path, or the absolute file path. The only threads I know say, don't put the file in a chrooted location, but I don't really have a choice, as the named.conf will reference the statistics file from a chrooted reference.

Any idea how to make this work? And no, I'm not going to unchroot my named.
Reply
0 Kudos
9 Replies
Dans_hyperic
Enthusiast
Enthusiast

Are your sure that your stat file is accesible from chroot environment?.. It is a relative path or absolute path or it is a link to another file.

As first stpe, I'll try to share the folder that contains the stats file with chroot (or use a folder with a hard link to this file as shared folder with chroot env.).

Dans
Reply
0 Kudos
anoonan
Contributor
Contributor

hmm... I'm not sure what you mean by 'share the folder' in a Linux context (as this is chrooted). My named.conf contains:

statistics-file "/var/named/data/named_stats.txt";

because this is a chrooted BIND install, this is a relative path to the chroot root, which is /var/named/chroot.

This means that the absolute path to the file is:
/var/named/chroot/var/named/data/named_stats.txt
and the relative path (inside the chroot) is:
/var/named/data/named_stats.txt

The hyperic user is able to access the file directly using the absolute path no problem. It can both read and write to the file. Since it is not running inside the chroot, the relative path does not make a lot of sense, of course, but I though that perhaps the agent is calling a tool that runs within the chrooted environment, so I've also tried to configure the agent to use the relative path. With both the absolute and relative paths, I get the above error.

In trying to interpret what you're saying, I also created first a symlink, and then a hard link for /var/named/data/named_stats.txt pointing to /var/named/chroot/var/named/data/named_stats.txt. This way, both relative and absolute paths are identical. Unfortunately, this resulted in the same error as before.
Reply
0 Kudos
Dans_hyperic
Enthusiast
Enthusiast

Thn, i have no idea about (i think that i was a chroot config)

See step 9th at http://support.hyperic.com/display/hypcomm/Monitoring+Bind+9.x+on+SLES+9

Ahm.. when i used "shared folder", i was talking about folders between enviroment and chroot enviroment. (on your case /var/named/chroot/var/named/data/).

Good luck
Reply
0 Kudos
anoonan
Contributor
Contributor

So I looked at the code for this monitor, and it's literally just opening a file, and failing with that error message if the file doesn't exist, so it should be very simple. I'm not sure what would cause that to fail, as I can take the name of the file given in the error message (which is the same name as I put in) and open the file as the hyperic user. I'll continue to investigate... there must be something wrong with what I'm doing.
Reply
0 Kudos
bjchip_hyperic
Enthusiast
Enthusiast

If all else fails a script to copy it out of the chroot might serve.
BJ
Reply
0 Kudos
bjchip_hyperic
Enthusiast
Enthusiast

The thing isn't using the OS to get at the file. It is using SIGAR.

BJ
Reply
0 Kudos
anoonan
Contributor
Contributor

Are you sure? The code in:

http://svn.hyperic.org/trunk/plugins/bind/src/org/hyperic/hq/plugin/bind/BindMeasurementPlugin.java?...

shows:

import java.io.File;
. . . . . . . . More imports and a few bits of code . . . . . . . .

String namedStats = props.getProperty(PROP_NAMED_STATS);

File statsFile = new File(namedStats);

// Test the stats file exists, and is writeable by the
// agent process.
if (!statsFile.exists()) {
throw new MetricNotFoundException("Stats file " + namedStats +
" does not exist. Please " +
"create this file and make " +
"sure it is writeable by " +
"the agent process");

That's the error message I get, and it looks like statsFile is just a standard java.io.File object. Since the error message seems to contain the name of the file I put in, namedStats seems to be a correct string. I'm just not sure why this would return as non-existent.
Reply
0 Kudos
bjchip_hyperic
Enthusiast
Enthusiast

No... not SURE, but I get suspicious when a common OS tool works and this doesn't and I know SIGAR is likely to be involved. The code snippet doesn't tell you where it is going.... "exists()" is not telling you where it is getting the information and SIGAR is underneath an lot of Hyperic general functionality .... remembering that most of it is OS neutral because SIGAR is used to cover over differences in underlying OS capabilities. Note that it imports the HYPERIC jdk.

I reserve the right to be wrong, but I would do this bit by working around it particularly if the advice you've uncovered just says not to chroot.

ciao
BJ
Reply
0 Kudos
bjchip_hyperic
Enthusiast
Enthusiast

http://www.hyperic.com/support/docs/sigar/

It didn't link further in but SIGAR is handling all fileinfo related requests and has the SIGAR file not found exception in the javadocs.

They compile those support libraries themselves. Still doesn't explain why you can't get there, but it is NOT going straight to the OS. I agree with their decision to isolate that level. The utilities are a lot easier to deal with as a layer, but you need to keep it in mind when something like this turns up.



BJ
Reply
0 Kudos