Creating data input methods
We have already seen how to create a data input method for simple SNMP queries. Let's look into creating a script-based data input method for retrieving some information out of the secure
log file. The secure
log file contains information about failed and successful logins. Please note that the following example will only work on a Linux system.
Preparation—creating the script
For a script/command data input method, you obviously need a script for gathering the required data and providing it to Cacti. Look at the unix_secure_log.pl
file. This Perl script will collect the necessary data for you.
Let's have a look at the commands used in the script. Within the first line of interest, you configure the path and filename to look for the data:
# Where do we find the secure log file ? my $secure_log = '/var/log/secure';
Gathering the data
The following important lines within the script retrieve the relevant Cacti data by executing a sequence of operating system commands:
...