Opening CACTI graphs from out Spectrum (monitoring appl.)
Moderators: Developers, Moderators
Opening CACTI graphs from out Spectrum (monitoring appl.)
Hi,
We use the Aprisma Spectrum monitoring application.
What we want to do, when we choose a device, and we right-click on that device, we want to open the associated CACTI graphs.
We can use the hostname and index from Spectrum to find the associated graphs into the cacti database.
Is there a kind of "standard" solution for this?
CACTI version 0.8.6c for Solaris.
Thx,
Stevevu
We use the Aprisma Spectrum monitoring application.
What we want to do, when we choose a device, and we right-click on that device, we want to open the associated CACTI graphs.
We can use the hostname and index from Spectrum to find the associated graphs into the cacti database.
Is there a kind of "standard" solution for this?
CACTI version 0.8.6c for Solaris.
Thx,
Stevevu
- TheWitness
- Developer
- Posts: 17007
- Joined: Tue May 14, 2002 5:08 pm
- Location: MI, USA
- Contact:
This would be very simple to do. A couple of SQL queries, knowledge of the cacti URL stored locally, and guest or some other form of access.
TheWitness
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?
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?
- TheWitness
- Developer
- Posts: 17007
- Joined: Tue May 14, 2002 5:08 pm
- Location: MI, USA
- Contact:
Please send me an e-mail and we can arrange an off hours (EST) discussion.
TheWitness
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?
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?
Cacti Search Script
Attached is the php code to create a search page that can be used to integrate cacti with other tools. It
hmm damn BB kept erroring out while I tried to post a reply.
Below is the php code to create a search page that can be used to integrate cacti with spectrum. Its not to sophisticated, just something I quickly put together. It can be easily changed to search against multiple cacti instances also.
Below is the php code to create a search page that can be used to integrate cacti with spectrum. Its not to sophisticated, just something I quickly put together. It can be easily changed to search against multiple cacti instances also.
Code: Select all
<?
$hostname = $_GET['hostname'];
$null = explode('.', "$hostname");
$site = $null[2];
$dbhost = "localhost";
$username = "cactidb_username_here";
$password = "cactidb_password_here";
$database = "cactidb";
$server = mysql_connect($dbhost, $username, $password) or die(mysql_error());
// Select the database now:
$connection = mysql_select_db($database, $server);
//Do queries here.
$query = "SELECT id from host where hostname = '$hostname'";
$result = mysql_query($query) or die(mysql_error());
while ($r = mysql_fetch_array($result)) {
$host_id = $r["id"];
$query2 = "SELECT graph_tree_id,id from graph_tree_items where host_id = '$host_id'";
$result2 = mysql_query($query2);
while ($r2 = mysql_fetch_array($result2)) {
$url="http://noc/cacti/graph_view.php?action=tree&tree_id=$r2[0]&leaf_id=$r2[1]";;
}
}
if($url == null) {
echo "<table>
<tr><td>Host Not found on Cacti [<a href=http://noc/cacti/>noc</a>]</td></tr>
</table>";
} else {
echo "<table>
<tr><td><meta http-equiv='refresh' content='1;url=$url'>
</table>";
}
//Close Connection
mysql_close($server);
?>
does this integration works
I'm very interested in the integration cacti with spectrum. where do i put this code? did anyone make this work? can i get more info from anyone?
thanks in advance
thanks in advance
-
- Posts: 8
- Joined: Mon Sep 10, 2007 11:24 am
grodno5,
I just tested this myself and got it to work. Basically take the sample code that was kindly provided by Bigel0w and put that in your cacti root directory as a .php file. Note you have to update a few things such as db user, pass, and base cacti URL. Then in your browser type http//cacti_url/php_file_just_created.php?hostname=Hostname
In this case "Hostname" is whatever you you have for a device in its Hostname value as seen in the Devices view in Cacti).
From Spectrum OneClick you can customize the right click menus (I think its custom-menu-config.xml, so when you right click a device in Spectrum, it will launch the related graphs in Cacti.
I just tested this myself and got it to work. Basically take the sample code that was kindly provided by Bigel0w and put that in your cacti root directory as a .php file. Note you have to update a few things such as db user, pass, and base cacti URL. Then in your browser type http//cacti_url/php_file_just_created.php?hostname=Hostname
In this case "Hostname" is whatever you you have for a device in its Hostname value as seen in the Devices view in Cacti).
From Spectrum OneClick you can customize the right click menus (I think its custom-menu-config.xml, so when you right click a device in Spectrum, it will launch the related graphs in Cacti.
Cacti with oneClick
mediastream,
would you please provide more details and maybe some snapshoots of your config.
what if my cacti and spectrum not on the same server?
i'm getting this error in the browser:
Host Not found on Cacti [noc]
if i run from command line, the error is:
[root@cacti]# php search.php
PHP Notice: Undefined index: hostname in /opt/cacti/search.php on line 3
PHP Notice: Undefined offset: 2 in /opt/cacti/search.php on line 7
PHP Notice: Undefined variable: url in /opt/cacti/search.php on line 53
<table>
<tr><td>Host Not found on Cacti [<a href=http://xx.xx.xx.xx/cacti/>noc</a>]</td></tr>
</table>
thanks in advance
would you please provide more details and maybe some snapshoots of your config.
what if my cacti and spectrum not on the same server?
i'm getting this error in the browser:
Host Not found on Cacti [noc]
if i run from command line, the error is:
[root@cacti]# php search.php
PHP Notice: Undefined index: hostname in /opt/cacti/search.php on line 3
PHP Notice: Undefined offset: 2 in /opt/cacti/search.php on line 7
PHP Notice: Undefined variable: url in /opt/cacti/search.php on line 53
<table>
<tr><td>Host Not found on Cacti [<a href=http://xx.xx.xx.xx/cacti/>noc</a>]</td></tr>
</table>
thanks in advance
Who is online
Users browsing this forum: No registered users and 3 guests