[SOLVED] Grab image

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
SeeD
Posts: 1
Joined: Tue Apr 08, 2008 5:18 am

[SOLVED] Grab image

Post by SeeD »

How I can take any graphs from cacti and insert it in other page? In html tag <img>.
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Right mouse click over the image and select "copy". Then "paste" in your applications. I do it all the time. When in graph zoom, you have to avoid the center of the image. Do it off to the side.

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Brian Blood
Posts: 10
Joined: Sat Apr 30, 2005 2:40 pm

Post by Brian Blood »

How can I programmatically grab a graph image using curl?

I want grab a graph every hour or so and have it available to view on a website completely different/separated from cacti.

Can I pass in credentials with the request line?


TIA.
Brian
Brian Blood
http://www.macserve.net/
noflies
Cacti User
Posts: 83
Joined: Sun Dec 18, 2005 9:30 am

Post by noflies »

Check out "Graph Export" to auto-generate graphs. Then use your favorite tool to transfer to another server.
Brian Blood
Posts: 10
Joined: Sat Apr 30, 2005 2:40 pm

Post by Brian Blood »

Thanks for the reply.

I'd like to grab an individual graph without having to turn on Graph Export for the whole server.

What I ended up doing was adding a bit of code to include/auth.php at the top right under the version check:

Code: Select all

if (!empty($_GET['auto_auth_key']))
{
	if ($config['auto_auth_key'] == $_GET['auto_auth_key'])
	{		//	$_POST["login_username"] . "' and password = '" . md5($_POST["login_password"]
		$username = preg_replace('/.*?(\w+).*/', '\1', trim($_GET['login_username']), 1);
		$password = sql_sanitize(md5(trim($_GET['login_password'])));
		$where = "username='$username' AND (password='$password')";
		$auto_auth_user_id = db_fetch_cell("select id from user_auth where $where");
		if (!empty($auto_auth_user_id)) {
			$_SESSION["sess_user_id"] = $auto_auth_user_id;
		}
	}
}
and then setting a hash value in the global $config var in config.php:
$config['auto_auth_key'] = 'MYSECRETAUTHKEY'

This allows me to put the entire graph_view.php request along with a normally defined users login name and password into a straight URL and pull down a graph image.
Brian Blood
http://www.macserve.net/
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest