Xymon Mailing List Archive search

checking for symlinks

5 messages in this thread

list Oliver · Wed, 1 Jul 2015 13:07:28 -0400 ·
I'm using Xymon 4.3.21 on a linux host with mix of linux and solaris clients

Is checking whether a file is symlink supported in analysis.cfg?  The
man page doesn't mention it but client_config.c does look like it
should work.

I have this in analysis.cfg
FILE /etc/.sudoers.local red type=symlink

My test goes red with the following statement:
File is a file - should be symlink

If I click on it, I see this:
[file:/etc/.sudoers.local]
type:100000 (file, symlink -> /bw/local/etc/.sudoers.local)
mode:440 (-r--r-----)
linkcount:1
owner:0 (root)
group:0 (root)
size:102
clock:1435770054 (2015/07/01-17:00:54)
atime:1336161370 (2012/05/04-19:56:10)
ctime:1377011564 (2013/08/20-15:12:44)
mtime:1377011564 (2013/08/20-15:12:44)

To prove it's a symlink:
# ls -l /etc/.sudoers.local
lrwxrwxrwx   1 root     root          28 Aug  2  2011
/etc/.sudoers.local -> /bw/local/etc/.sudoers.local

What am I doing wrong?
list Japheth Cleaver · Wed, 1 Jul 2015 11:51:55 -0700 ·
quoted from Oliver
On Wed, July 1, 2015 10:07 am, oliver wrote:
I'm using Xymon 4.3.21 on a linux host with mix of linux and solaris
clients

Is checking whether a file is symlink supported in analysis.cfg?  The
man page doesn't mention it but client_config.c does look like it
should work.

I have this in analysis.cfg
FILE /etc/.sudoers.local red type=symlink

My test goes red with the following statement:
File is a file - should be symlink

If I click on it, I see this:
[file:/etc/.sudoers.local]
type:100000 (file, symlink -> /bw/local/etc/.sudoers.local)
mode:440 (-r--r-----)
linkcount:1
owner:0 (root)
group:0 (root)
size:102
clock:1435770054 (2015/07/01-17:00:54)
atime:1336161370 (2012/05/04-19:56:10)
ctime:1377011564 (2013/08/20-15:12:44)
mtime:1377011564 (2013/08/20-15:12:44)

To prove it's a symlink:
# ls -l /etc/.sudoers.local
lrwxrwxrwx   1 root     root          28 Aug  2  2011
/etc/.sudoers.local -> /bw/local/etc/.sudoers.local

What am I doing wrong?

I believe this is a bug. Might never have really been fully implemented,
actually.

Can you try the following patch (untested) and see if it works for you?


Regards,

-jc
Attachments (1)
list Oliver · Wed, 1 Jul 2015 18:44:25 -0400 ·
Applied patch to source, recompiled and installed but no change in
behaviour I'm afraid
quoted from Japheth Cleaver

On Wed, Jul 1, 2015 at 2:51 PM, J.C. Cleaver <user-87556346d4af@xymon.invalid> wrote:
On Wed, July 1, 2015 10:07 am, oliver wrote:
I'm using Xymon 4.3.21 on a linux host with mix of linux and solaris
clients

Is checking whether a file is symlink supported in analysis.cfg?  The
man page doesn't mention it but client_config.c does look like it
should work.

I have this in analysis.cfg
FILE /etc/.sudoers.local red type=symlink

My test goes red with the following statement:
File is a file - should be symlink

If I click on it, I see this:
[file:/etc/.sudoers.local]
type:100000 (file, symlink -> /bw/local/etc/.sudoers.local)
mode:440 (-r--r-----)
linkcount:1
owner:0 (root)
group:0 (root)
size:102
clock:1435770054 (2015/07/01-17:00:54)
atime:1336161370 (2012/05/04-19:56:10)
ctime:1377011564 (2013/08/20-15:12:44)
mtime:1377011564 (2013/08/20-15:12:44)

To prove it's a symlink:
# ls -l /etc/.sudoers.local
lrwxrwxrwx   1 root     root          28 Aug  2  2011
/etc/.sudoers.local -> /bw/local/etc/.sudoers.local

What am I doing wrong?

I believe this is a bug. Might never have really been fully implemented,
actually.

Can you try the following patch (untested) and see if it works for you?


Regards,

-jc
list Jeremy Laidman · Thu, 2 Jul 2015 11:54:24 +1000 ·
It'd be good to have this feature working.

In the mean time, you could use "FILE" (in analysis.cfg) to check for the
existence of a file, and use a backtick command (in client-local.cfg) to
specify the filename only if it's a symlink.  Example:

analysis.cfg:

FILE /etc/.sudoers.local red

client-local.cfg:

file:`find /etc/.sudoers.local -type l`

If the file is a symlink, it will exist.  If it's not a symlink, the Xymon
client won't see it, and you'll get a RED as if it didn't exist.

Cheers
Jeremy
quoted from Oliver


On 2 July 2015 at 08:44, oliver <user-c44cbd0c692f@xymon.invalid> wrote:
Applied patch to source, recompiled and installed but no change in
behaviour I'm afraid

On Wed, Jul 1, 2015 at 2:51 PM, J.C. Cleaver <user-87556346d4af@xymon.invalid>
wrote:
On Wed, July 1, 2015 10:07 am, oliver wrote:
I'm using Xymon 4.3.21 on a linux host with mix of linux and solaris
clients

Is checking whether a file is symlink supported in analysis.cfg?  The
man page doesn't mention it but client_config.c does look like it
should work.

I have this in analysis.cfg
FILE /etc/.sudoers.local red type=symlink

My test goes red with the following statement:
File is a file - should be symlink

If I click on it, I see this:
[file:/etc/.sudoers.local]
type:100000 (file, symlink -> /bw/local/etc/.sudoers.local)
mode:440 (-r--r-----)
linkcount:1
owner:0 (root)
group:0 (root)
size:102
clock:1435770054 (2015/07/01-17:00:54)
atime:1336161370 (2012/05/04-19:56:10)
ctime:1377011564 (2013/08/20-15:12:44)
mtime:1377011564 (2013/08/20-15:12:44)

To prove it's a symlink:
# ls -l /etc/.sudoers.local
lrwxrwxrwx   1 root     root          28 Aug  2  2011
/etc/.sudoers.local -> /bw/local/etc/.sudoers.local

What am I doing wrong?

I believe this is a bug. Might never have really been fully implemented,
actually.

Can you try the following patch (untested) and see if it works for you?


Regards,

-jc
list Oliver · Thu, 2 Jul 2015 09:00:44 -0400 ·
quoted from Jeremy Laidman
On Wed, Jul 1, 2015 at 9:54 PM, Jeremy Laidman <user-71895fb2e44c@xymon.invalid> wrote:
In the mean time, you could use "FILE" (in analysis.cfg) to check for the
existence of a file, and use a backtick command (in client-local.cfg) to
specify the filename only if it's a symlink.  Example:

analysis.cfg:

FILE /etc/.sudoers.local red

client-local.cfg:

file:`find /etc/.sudoers.local -type l`

If the file is a symlink, it will exist.  If it's not a symlink, the Xymon
client won't see it, and you'll get a RED as if it didn't exist.
Thanks!  Test is successful.