Custom Environment Variables In Alert Script

by Oct 31, 2014



I have a question concerning the following setup:

  • We have modified the File and Directory Monitor plug-in XML and PHP to support passing the “minutesOld” and “hoursOld” fields as input parameters to the agent script (respectively as “UPTIME_MINUTESOLDINPUTPARAM” and “UPTIME_HOURSOLDINPUTPARAM”)
  • We put the new environment variable values as arguments on the “agentcmd rexec” call that is executed from within the plug-in PHP.
  • In the agent script, we can effectively see and use those new command line argument values.

    Depending on the value of the “minutesOldInputParam” or “hoursOldInputParam”, we append specific file paths to the output or not. This way we show a list of files that are effectively too old to the users.

  • This part works perfectly.


  • We also created a custom alert script to be able to parse and reduce the output that needs to be e-mailed to the users.
  • In that script we already used evironment variables like “UPTIME_EMAIL”, “UPTIME_SVCNAME” and “UPTIME_SVCOUTPUT”.
  • But when I try the same thing as in the PHP and agent script, to fetch the variables “UPTIME_MINUTESOLDINPUTPARAM” or “UPTIME_HOURSOLDINPUTPARAM”, those seem to be empty.

    Because of that, I cannot dynamically append the requested file age threshold to the e-mail.

    The e-mail should start with a line like: “The following files were found to be older than minutes | hours:”

Are those environment variables not on the process environment anymore when the alert script is being executed?

Do they need to be passed in another way? Or is this currently impossible?


Thanks for your help.

Kind regards.