My graphs are broken images

Post support questions that directly relate to Linux/Unix operating systems.

Moderators: Developers, Moderators

Post Reply
User avatar
bmote
Cacti User
Posts: 50
Joined: Thu Jul 15, 2010 1:12 pm
Location: Cincinnati, OH
Contact:

My graphs are broken images

Post by bmote »

I'm working through moving Cacti from a sandbox environment to a production environment. I'm chronicling the effort here: http://forums.cacti.net/viewtopic.php?t=39367

In addition I applied the permissions listed in the documentation under the "upgrading cacti" section.

I can login and my devices all show up in the list. I can query them with SNMP and they return results, but when I go to view the graphs they all show up as broken images/red-x.
Bill Mote
blog: http://ThingsThatMakeMeMadAndHowToFixThem.blogspot.com
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Are the rrd files present (see Graph Management -> Debug Mode)?
Does Settings -> RRDTool Utility Version match the version of rrdtool used (rrdtool --version)?
R.
User avatar
bmote
Cacti User
Posts: 50
Joined: Thu Jul 15, 2010 1:12 pm
Location: Cincinnati, OH
Contact:

Post by bmote »

I checked my RRD Tool version. It's 1.2 and my Cacti is setup for 1.2.

The RRD files do exist in /var/www/html/cacti/rra but they're not being updated. I'm guessing it's going to be a permissions issue.

They are cacti:root at present. Still digging ... thanks for the reply.
Bill Mote
blog: http://ThingsThatMakeMeMadAndHowToFixThem.blogspot.com
User avatar
bmote
Cacti User
Posts: 50
Joined: Thu Jul 15, 2010 1:12 pm
Location: Cincinnati, OH
Contact:

Post by bmote »

Code: Select all

RRDTool Command:
/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title='Build03 (RHEL 4) (vm02) - CPU Utilization - CPU0' \
--rigid \
--base=1000 \
--height=120 \
--width=500 \
--upper-limit='100' \
--lower-limit='0' \
--vertical-label='percent' \
--slope-mode \
--font TITLE:12: \
--font AXIS:8: \
--font LEGEND:10: \
--font UNIT:8: \
DEF:a="/var/www/html/cacti/rra/build03_rhel_4_cpu_99.rrd":cpu:AVERAGE \
AREA:a#55009DFF:"CPU Utilization"  \
GPRINT:a:LAST:"Current\:%8.0lf"  \
GPRINT:a:AVERAGE:"Average\:%8.0lf"  \
GPRINT:a:MAX:"Maximum\:%8.0lf\n" 
RRDTool Says:
ERROR: This RRD was created on other architecture
Well, well, well ...

This is either due to the CentOS 5.5 vs. RHEL 5.5, or more likely, because the original was captured in 32-bit and the new installation is 64-bit.

Thoughts?
Bill Mote
blog: http://ThingsThatMakeMeMadAndHowToFixThem.blogspot.com
User avatar
bmote
Cacti User
Posts: 50
Joined: Thu Jul 15, 2010 1:12 pm
Location: Cincinnati, OH
Contact:

Post by bmote »

Does this sound reasonable?

Code: Select all

So we need to export the files to xml and then reimport them:

rrdtool dump filename.rrd > filename.xml
rrdtool restore filename.xml > filename.rrd

But if you’ve got dozens, hundreds or even thousands of RRD files, doing them one by one is going to get tired, very quickly. So here we go:

oldcacti:/usr/share/cacti/site/rra/# ls -1 *.rrd | awk '{print "rrdtool dump "$1" > "$1".xml"}' | sh -x
scp *.xml root@newcacti:/usr/share/cacti/site/rra/

followed by:

newcacti:/usr/share/cacti/site/rra/# rm *.rrd
newcacti:/usr/share/cacti/site/rra/# ls -1 *.rrd.xml | sed 's/\.xml//' | awk '{print "rrdtool restore "$1".xml "$1}' | sh -x
newcacti:/usr/share/cacti/site/rra/# rm *.xml
newcacti:/usr/share/cacti/site/rra/# chown www-data:www-data *

That should be it, the final chown ensures that Apache can actually open the files and present them. Assuming Cacti et al is configured right on newcacti, you should be seeing some pretty graphs 
Bill Mote
blog: http://ThingsThatMakeMeMadAndHowToFixThem.blogspot.com
User avatar
bmote
Cacti User
Posts: 50
Joined: Thu Jul 15, 2010 1:12 pm
Location: Cincinnati, OH
Contact:

Post by bmote »

ROCK ON! THAT PROCESS WORKED!

I'm going to modify my backup to make it export the RRD data into XML. Then it will be portable no matter the destination.
Bill Mote
blog: http://ThingsThatMakeMeMadAndHowToFixThem.blogspot.com
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

bmote wrote:This is either due to the CentOS 5.5 vs. RHEL 5.5, or more likely, because the original was captured in 32-bit and the new installation is 64-bit.
That's it, as you discovered in the meantime
R.
User avatar
bmote
Cacti User
Posts: 50
Joined: Thu Jul 15, 2010 1:12 pm
Location: Cincinnati, OH
Contact:

Post by bmote »

You know what they say about bellybuttons and opinions? Everybody has one; some stink more than others ...

What do you think about updating the documentation with regards to Cacti upgrading and/or backups with:

Code: Select all

currentDatetime=`date +%Y%m%d%H%M` 
backupDir=/var/backups 

mysqldump -l --add-drop-table cacti -u cacti -pSOMEPASSWORD > $backupDir/$currentDatetime-cacti-mysql-backup.sql 
gzip $backupDir/$currentDatetime-cacti-mysql-backup.sql 

ls -1 /var/www/html/cacti/rra/*.rrd | awk '{print "rrdtool dump "$1" > "$1".xml"}' | sh -x 

tar zcfpv $backupDir/$currentDatetime-cacti-config-backup.tgz /var/www/html/cacti/include/config.php /etc/snmp/snmpd.conf /etc/my.cnf /etc/httpd/conf.d/cacti.conf /etc/spine.conf /etc/php.ini /etc/php.d/mysql.ini /etc/php.d/snmp.ini /etc/httpd/conf/httpd.conf /etc/httpd/conf.d/php.conf /var/www/html/cacti/rra/*.xml /var/www/html/cacti/scripts/* /var/www/html/cacti/plugins/* /var/www/html/cacti/resource/* --index-file=$backupDir/$currentDatetime-backup.log 

rm /var/www/html/cacti/rra/*.xml 

# to import the RRD data run the following commands: 

# sudo rm /var/www/html/cacti/rra/*.rrd 
# sudo ls -1 /var/www/html/cacti/rra/*.rrd.xml | sed 's/\.xml//' | awk '{print "rrdtool restore "$1".xml "$1}' | sudo sh -x 
# sudo rm /var/www/html/cacti/rra/*.xml 
# sudo chown cacti:cacti *
Last edited by bmote on Mon Aug 23, 2010 6:35 am, edited 1 time in total.
Bill Mote
blog: http://ThingsThatMakeMeMadAndHowToFixThem.blogspot.com
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

I'm ok with some text. The script won't be very helpful for windows or mac users. Please point me to a direction, were you'd love to find the wors and I will update momentarily.
Or do it on your own, it's a dokuwiki
R.
User avatar
bmote
Cacti User
Posts: 50
Joined: Thu Jul 15, 2010 1:12 pm
Location: Cincinnati, OH
Contact:

Post by bmote »

Hmmmm ... hadn't thought of environments outside of Linux.

Maybe, if at all, the change should be general guidance concerning what might change and how to dump the RRD files so they can be imported into any RRD environment?

Code: Select all

/var/www/html/cacti/include/config.php
/etc/snmp/snmpd.conf
/etc/my.cnf
/etc/httpd/conf.d/cacti.conf
/etc/spine.conf
/etc/php.ini
/etc/php.d/mysql.ini
/etc/php.d/snmp.ini
/etc/httpd/conf/httpd.conf
/etc/httpd/conf.d/php.conf
/var/www/html/cacti/rra/*.xml
/var/www/html/cacti/scripts/*
/var/www/html/cacti/plugins/*
/var/www/html/cacti/resource/*
The paths won't cross pollinate either. I know. Just hashing through ideas.

Thoughts?
Bill Mote
blog: http://ThingsThatMakeMeMadAndHowToFixThem.blogspot.com
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Ok, so far. Those may serve as a hint where to look at. People may have to transform to their system.
R.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests