Cacti Beginner's Guide(Second Edition)
上QQ阅读APP看书,第一时间看更新

Preparation - creating the script

For a script/command data input method, you will 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.

Differences between CentOS and other Linux versions

As you may have noticed, the book mainly focuses on the CentOS/RHEL based Linux system. Some of the settings and paths in the following scripts may not be the same on your Linux version. An example is the /var/log/secure file, which contains failed login and authentication failures in CentOS. For Debian based systems this is actually /var/log/auth.log. Please make sure to check your file paths in case you run into  any issues with the scripts.

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 ? 
# Debian/Ubuntu: /var/log/auth.log 
# CentOS/RHEL  : /var/log/secure 
my $secure_log = '/var/log/secure';