上QQ阅读APP看书,第一时间看更新
Time for action - creating the poller's cron entry and Cacti's system account
Let's create the cron entry so the poller runs frequently:
- To create a user called cactiuser, issue the following command as root. It will also add the user to the apache group:
adduser --groups apache cactiuser
- Change to the cacti directory:
cd /var/www/html/cacti
- Change the ownership of the cacti directory, the newly created user, and apache. You will also change the permissions of some special directories as well as enable the apache user group to write to the rra and log directory. The setfacl command is important for some internal Cacti processes to work properly and makes sure that the apache user is able to write to these directories:
chown -R cactiuser.apache /var/www/html/cacti/ chmod -R 775 rra/ log/ resource/ scripts/ cache/ setfacl -d -m group:apache:rw /var/www/html/cacti/rra setfacl -d -m group:apache:rw /var/www/html/cacti/log
- Add the poller cron entry. Edit the cacti file in /etc/cron.d:
vi /etc/cron.d/cacti
- Add the following line to the file:
*/1 * * * * cactiuser /usr/bin/php /var/www/html/cacti/poller.php > /dev/null 2>&1
- Save the file.