jablonka.czprosek.czf

weathermap

Subversion Repositories:
[/] [lib/] [ds-common.php] - Blame information for rev 132

 

Line No. Rev Author Line
185simandl<?php
2// Shared code for DSStats and RRD DS plugins
3//
4 function UpdateCactiData(&$item, $local_data_id)
5 {
6 $set_speed = intval($item->get_hint("cacti_use_ifspeed"));
7 
8 $r3 = db_fetch_assoc(sprintf("select data_local.host_id, field_name,field_value from data_local,host_snmp_cache where data_local.id=%d and data_local.host_id=host_snmp_cache.host_id and data_local.snmp_index=host_snmp_cache.snmp_index and data_local.snmp_query_id=host_snmp_cache.snmp_query_id",$local_data_id));
9 foreach ($r3 as $vv)
10 {
11 $vname = "cacti_".$vv['field_name'];
12 $item->add_note($vname,$vv['field_value']);
13 }
14 
15 if($set_speed != 0)
16 {
17 # $item->max_bandwidth_in = $vv['field_value'];
18 # $item->max_bandwidth_out = $vv['field_value'];
19 
20 $ifSpeed = intval($item->get_note('cacti_ifSpeed'));
21 $ifHighSpeed = intval($item->get_note('cacti_ifHighSpeed'));
22 $speed = 0;
23 if($ifSpeed > 0) $speed = $ifSpeed;
24 # see https://lists.oetiker.ch/pipermail/mrtg/2004-November/029312.html
25 if($ifHighSpeed > 20) $speed = $ifHighSpeed."M";
26 
27 if($speed >0)
28 {
29 // might need to dust these off for php4...
30 if($item->my_type() == 'NODE')
31 {
32 $map->nodes[$item->name]->max_bandwidth_in = $speed;
33 $map->nodes[$item->name]->max_bandwidth_out = $speed;
34 }
35 if($item->my_type() == 'LINK')
36 {
37 $map->links[$item->name]->max_bandwidth_in = $speed;
38 $map->links[$item->name]->max_bandwidth_out = $speed;
39 }
40 }
41 }
42 
43 if(isset($vv['host_id'])) $item->add_note("cacti_host_id",intval($vv['host_id']));
44 
45 $r4 = db_fetch_row(sprintf("SELECT DISTINCT graph_templates_item.local_graph_id,title_cache FROM graph_templates_item,graph_templates_graph,data_template_rrd WHERE data_template_rrd.id=task_item_id and graph_templates_graph.local_graph_id = graph_templates_item.local_graph_id and local_data_id=%d LIMIT 1",$local_data_id));
46 if(isset($r4['local_graph_id'])) $item->add_note("cacti_graph_id",intval($r4['local_graph_id']));
47 }
48 

Powered by WebSVN 2.2.1