Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to wget a specific cacti graph image in order to make a daily report. We have htpasswd for the cacti website, and I've added a user for that. I'm usign wget's --http-user/password to pass it. That's working because without it, I get 403 Authorization Required back. However when I try to wget the image, I get redirected to index.php. What is it doing?

I've tried to change the user agent to the same as my Firefox in wget, no change. I've set the referer in wget to be the cacti page, no change. What is it doing? Is there something special with http auth and wget?

share|improve this question
up vote 3 down vote accepted

You can pass cookie info with your wget command:

wget --help | grep cookie
   --cookies=off         don't use cookies.
   --load-cookies=FILE   load cookies from FILE before session.
   --save-cookies=FILE   save cookies to FILE after session.
share|improve this answer

From what you've described it sounds like you've applied BasicAuth over the top of Cacti's builtin authorization mechanism. So by providing --http-user you are being allowed access to the web resource, but Cacti still doesn't know who you are, so it is redirecting you to a login page.

You probably have two options:

  • Provide wget a cookie so that it remains logged in.
  • Switch to "Web Basic Authentication" under settings.
share|improve this answer
We're already using Web Basic authentication – Rory Aug 4 '09 at 14:00
Ah yes it's the cookies and session cookies. – Rory Aug 4 '09 at 14:10

You can set cacti to pre-generate graphs on a regular basis and then stick them somewhere you can get at them. This avoids the identifying-yourself-to-cacti problem.

Go: console -> Configuration -> Settings -> Graph Export

You probably want to export to local file system, then put the graphs in some location where you can wget them from. Note that this seems to generate ALL graphs all at once which might be a significant impact on your system (depending on your system and complexity of cacti install) and make available more information than you really want to.

(This is true for cacti 0.8.7b, and, I presume, better versions.)

share|improve this answer
Yes I looked at the graph export, but it has a few flaws. Ideally I want a twice daily export. But you can'd do that in cacti. It's either every hour or everyday. Also it is a significant performance hog, so much so that nagios started going mad when I tried to export it. Also I don't need all the graphs. – Rory Aug 4 '09 at 23:21

I would start by checking the server logs (Apache perhaps) to see if there is any more information. Can you show us the command with different username and pass?

Oh, didn't read carefully enough, sorry. Are you sure the images are not generated dynamically as you request them? If they are not already there, the link will be invalid, the apache log might show you that.

share|improve this answer
The images are being generated by a PHP script. I'm calling that PHP script. In the browser it works fine. – Rory Aug 4 '09 at 13:54

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.