Home Linux & Systems Cybersecurity Cloud & DevOps Networks & Infrastructure SIEM & Monitoring DFIR & Threat Intel Development & Other All categories Projects About Tools

Cacti does not generate graphics

Leer en espanol
Cacti does not generate graphics

Table of contents

If we go to Grash List within our device We select the graph ===

Hello, there are times when we have errors in cacti which we see that it does not show graphics…. This is usually easy to fix.

If we go to Grash List within our device

Pantallazo 18

We select the graph that is giving us an error.

Pantallazo 19

Once inside we click on debug (*Turn On Graph Debug Mode) and the following error will appear:

ERROR: opening ‘/var/www/cacti/rra/cpd_users_8.rrd’: No such file or directory

Pantallazo 171

We log in to our server and perform the following steps

root@cacti:~# crontab -e 

and we add the following line:

*/5 * * * * /usr/bin/php /var/www/cacti/poller.php >/dev/null 2>/var/www/cacti/log/poller-error.log

And we execute the following command

root@cacti:~# php /var/www/cacti/poller.php
PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/lib/php5/20090626+lfs/gd.so’ – /usr/lib/php5/20090626+lfs/gd.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/lib/php5/20090626+lfs/gd.so’ – /usr/lib/php5/20090626+lfs/gd.so: cannot open shared object file: No such file or directory in Unknown on line 0
OK u:0.02 s:0.00 r:0.73
OK u:0.02 s:0.00 r:0.74
OK u:0.02 s:0.00 r:0.77
OK u:0.02 s:0.00 r:0.77
OK u:0.02 s:0.00 r:0.87
OK u:0.02 s:0.00 r:0.87
OK u:0.02 s:0.00 r:0.92
OK u:0.02 s:0.00 r:0.97
OK u:0.02 s:0.01 r:1.02
OK u:0.02 s:0.01 r:1.07
OK u:0.02 s:0.01 r:1.11
OK u:0.02 s:0.01 r:1.17
OK u:0.02 s:0.01 r:1.21
OK u:0.02 s:0.01 r:1.27
06/29/2012 11:59:09 AM – SYSTEM STATS: Time:1.5696 Method:cmd.php Processes:1 Threads:N/A Hosts:3 HostsPerProcess:3 DataSources:11 RRDsProcessed:7

Y listo!!! si vamos de nuevo a nuestro debug ya tendría que aparecer OK

Pantallazo 20

If this doesn't work... we can create the graph by hand

CODE
Bash
root@cacti:~# /usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title='CPD - CPU Utilization - CPU0' \
--rigid \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit='0' \
--vertical-label='percent' \
--slope-mode \
--font TITLE:10: \
--font AXIS:7: \
--font LEGEND:8: \
--font UNIT:7: \
DEF:a="/var/www/cacti/rra/cpd_cpu_10.rrd":'cpu':AVERAGE \
AREA:a#FF0000FF:"CPU Utilization"  \
GPRINT:a:LAST:"Current\:%8.0lf"  \
GPRINT:a:AVERAGE:"Average\:%8.0lf"  \
GPRINT:a:MAX:"Maximum\:%8.0lf\n"

we give permissions

Bash
chmod 777 /var/www/cacti/rra/cpd_cpu_10.rrd

Greetings, rokitoh!

Comments