Dynamic "with path" value

Issue #702 new
Artem Russakovskii created an issue

Hi,

Is it possible to add support for a dynamic "with path" value so that I can calculate the file name on the fly? For example:

check file syslog with path "readlink -f /usr/bin/java | sed -En 's@bin/java@lib/security/java.security@p'"
  if content = "SSL" then alert

The readlink and sed command produces /usr/lib64/jvm/java-1.8.0-openjdk-1.8.0/jre/lib/security/java.security on my machine, and that's the file I'd like checked. However, if java 1.9 came out and the path changed, I'd like monit to automatically pick that up because the output of the command in quotes would change too.

Unfortunately, monit doesn't seem to like this path right now with this error:

/etc/monitrc:254: syntax error '"readlink -f /usr/bin/java | sed -En 's@bin/java@lib/security/java.security@p'"'

Maybe there's another way, but it'd be nice to support dynamic file names like this.

Thanks.

Comments (1)

  1. Artem Russakovskii reporter

    I ended up using a custom script that checks that file and using monit's check program functionality.

  2. Log in to comment