Cacti's automatic graph export functionality is nice, but I'm having some problems with it on Debian Squeeze:
I also want different representations downloaded in different intervals, so I thought I'd check if I'm able to manually fetch the graph images using "wget".Jun 17 11:48:01 host1 /USR/SBIN/CRON[28671]: (www-data) CMD (php /usr/share/cacti/site/poller.php >/dev/null 2>/var/log/cacti/poller-error.log)
Jun 17 11:48:25 host1 suhosin[28675]: ALERT - script tried to disable memory_limit by setting it to a negative value -1 bytes which is not allowed (attacker 'REMOTE_ADDR not set', file 'unknown')
Jun 17 11:48:25 host1 suhosin[28672]: ALERT - script tried to disable memory_limit by setting it to a negative value -1 bytes which is not allowed (attacker 'REMOTE_ADDR not set', file 'unknown')
1) The session-handling of Cacti does not like wget:
I tried in different variations, and some forum entries said it's possible, but I didn't find an example of syntax that actually allowed me to download a dump of the "graph preview" page, where the graph images were actually there (and not the login).
So, we'll change to "Web Basic Authentication". The following steps are for Apache2:
2) Create htpasswd/htgroup files for Cacti users:
On Debian systems, you will find Cacti's config in "/etc/cacti".
There you put 2 files: htpasswd (for usernames+passwords) and htgroup (for group assignment).
First, create a htpasswd file for your user:
Code: Select all
htpasswd -m -c /etc/cacti/htpasswd <username>
Code: Select all
cacti: <username>
On Debian systems, the Apache settings for Cacti are automatically installed in "/etc/apache2/conf.d/cacti.conf", which is actually a symlink:
Edit that file and add the following lines in the "<Directory>" block:/etc/apache2/conf.d/cacti.conf -> ../../cacti/apache.conf
Code: Select all
# Web Basic Authentication for Cacti (instead of built-in):
AuthType Basic
AuthName "Haus-Sensoren"
AuthUserFile /etc/cacti/htpasswd
AuthGroupFile /etc/cacti/htgroup
Require group cacti
Code: Select all
/etc/init.d/apache2 reload
Logon to Cacti (as admin), go to the "Console" and open the following page:
Now open each user and switch the authentication method to "Web Basic".Utilities > User Management
5) Change Cacti to "Web Basic" authentication:
Open the following page in Cacti's Console:
Now, change the logon method to "Web Basic".Configuration > Settings > Authentication
6) Logging onto, and downloading the graphs using wget:
Now, that authentication has been changed to "Web Basic", we can use wget's built-in parameters "--user" and "--password", like this:
Code: Select all
$ wget --restrict-file-names=windows --user='<username>' --password='<password>' -l 1 -r -P /folder/where_to_put/the_graphs http://status.myserver.com/cacti/graph_view.php?action=preview
References: