Cacti - Changing environment variables at runtime.
I'm using the Cacti script/command method to collect data. I have a perl script that connects to an Oracle database and returns two numbers. This script works perfectly when run on the command line (Unix).
For this perl script to work properly I have to define several environment variables so that it is able to connect to Oracle.
$ENV{ORACLE_HOME} = ...etc...
But - when I create a data input method in Cacti to run this perl script... I recieve an error stating that it is unable to find the DBD/Oracle.pm. (This is because the environment variables are not being set by Perl).
开发者_运维百科Does anyone know why the ENV variables are set properly when I run this on command line?
But they are not able to be set when run by Cacti?
By the way - Cacti is running the perl script as root.
Solved!
The issue ended up being that Root did not have read access to the Oracle.pm.
Once I stopped looking into the ENV variables being the problem... the permissions were the next obvious issue.
Thanks for your help in the comments.
精彩评论