A CactiDataInput is a script stored on the server Cacti runs on, which outputs some information onto standard out when it is executed.
Important things to consider when writing scripts for this purpose:
- It must output space separated values, on one line
- It must be executable by the user that runs the cacti scripts, which is typically the same as the user your webserver runs as. Using sudo or setuid binaries to get around this may be a security risk for some applications so treat this carefully.
Go to the data input page in cacti, and click 'add'.
There are three fields at first: Name, Input String and Output String
Name is verbose name, used for user recognition. Be verbose, include spaces, etc. 'Get LM Sensors' is an example.
- Input String is the command line that is executed when the script is run. An example would be
- perl <path_cacti>/scripts/check_sensors.pl
This says to run perl with the script at <path_cacti>/scripts/check_sensors.pl (<path_cacti> is automatically expanded). Note that if you need to provide command line arguments to your scripts, you can specify them here too, eg
perl <path_cacti>/scripts/check_smart.pl <disk>
We will talk more about input strings later.
- Output String is the expected format of the output from the script specified in 'Input String'. For the check_sensors.pl script mentioned earlier, an output string might be
- <fan1> <fan2> <fan3> <temp1> <temp2> <temp3>
We'll talk more about these later.
For each of the Input and Output fields you entered, (eg, <disk>, <fan1> etc), you need to add a Data Input Source Field.
The format of these is very simple:
Name is a verbose name
Data Name is the name of the data field you are creating this for (eg, <disk>, <fan1> etc)
Input/Output specifies just that.
Update RRA should be checked for all output fields, and one input field (I think?)
Once this is complete, press Save
This is just a Data Input mechanism. This isn't actually a Data Source. To actually have cacti retrieving data you need to add a CactiDataSource? next