Hi Frz,
I want to know that is is possible to add Device Interface Details in Cacti
through CLI.Like i have a router (10.0.12.102 ) and Interfaces like Ethernate0/0,Ethernate0/1 etc.i need to add this interface details in cacti to genarate graph.
Please suggest me the possible steps to achive this.
Thanks
Adding Device Detailsin Cacti using CLI
Moderators: Developers, Moderators
- TheWitness
- Developer
- Posts: 17062
- Joined: Tue May 14, 2002 5:08 pm
- Location: MI, USA
- Contact:
The add_graph.php cli script is what you need. You should investigate how it works. I will be making significant performance enhancements to it in Cacti 0.8.7c once released in August.
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: 17062
- Joined: Tue May 14, 2002 5:08 pm
- Location: MI, USA
- Contact:
I can post a nice function. Let me see about it. I will send myself a pm with this post.
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: 17062
- Joined: Tue May 14, 2002 5:08 pm
- Location: MI, USA
- Contact:
Here you go. Does Regular Expression Matches as well:
You will have to define the "globals" in the parent function.
Regards,
TheWitness
Code: Select all
function add_graphs_for_dq($host, $graph_template_id, $snmp_query_id, $snmp_query_type_id, $snmp_field_name, $regmatch = "", $include = "on") {
global $config, $php_bin, $path_grid, $path_cacti;
/* let's see what queries are defined for this host */
$query_types = exec_into_array("$php_bin -q $path_grid/grid_add_graphs.php --host-id=" . $host["id"] . " --snmp-query-id=$snmp_query_id --list-query-types");
$found = false;
foreach($query_types as $type) {
if (substr_count($type, $snmp_query_type_id)) {
$found = true;
break;
}
}
/* now let's create some graphs, otherwise log and error */
if ($found) {
$items = exec_into_array("$php_bin -q $path_cacti/cli/add_graphs.php --host-id=" . $host["id"] . " --snmp-query-id=$snmp_query_id --snmp-field=$snmp_field_name --list-snmp-values");
if (sizeof($items)) {
foreach($items as $item) {
if ((trim($item) == "") ||
(substr_count($item, "Known")) ||
(substr_count($item, "FATAL:")) ||
(substr_count($item, "ERROR:"))) {
/* ignore */
continue;
}else{
if ($regmatch == "") {
/* add graph below */
}else if ((($include == "on") && (ereg($regmatch, $item))) ||
(($include != "on") && (!ereg($regmatch, $item)))) {
/* add graph below */
}else{
echo "NOTE: Bypassig item due to Regex rule: $item for Query Type ID: $snmp_query_type_id and Cluster: " . $cluster["clustername"] . "\n";
continue;
}
echo "NOTE: Adding item: $item for Query Type ID: $snmp_query_type_id and : " . $host["hostname"] . "\n";
$command = "$php_bin -q $path_cacti/cli/add_graphs.php" .
" --graph-template-id=$graph_template_id --graph-type=ds" .
" --snmp-query-type-id=$snmp_query_type_id --host-id=" . $host["id"] .
" --snmp-query-id=$snmp_query_id --snmp-field=$snmp_field_name" .
" --snmp-value=$item";
echo trim(shell_exec($command)) . "\n";
}
}
}
}else{
cacti_log("WARNING: Query Type ID ID: $snmp_query_type_id Not Assocated with Host: " . $host["hostname"], TRUE, "RTM");
}
}
You will have to define the "globals" in the parent function.
Regards,
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?
Who is online
Users browsing this forum: No registered users and 5 guests