How to make custome live graph

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

Post Reply
myazdian
Posts: 1
Joined: Tue Mar 14, 2017 2:06 am

How to make custome live graph

Post by myazdian »

Hellow everyone
I new in cacti but I have more information about web programming like as .NET and PHP
Now I like to use some graph from my internet traffic all in one page as a live for each 15sec.

In my page I post the many parameterts to graph_ajax_rt.php in the realtime plugins like as "graph_start=-1800&graph_end=0&local_graph_id=33&ds_step=5&count=35&sync=on"

But mu problem is some times this graphs are work and after some times is not work for example 15Min work fin and after that traffic is not real of complet graphs is not work...!!!

please helmp me to solv this issus.
Thank you

Image

Code: Select all

<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<script>
var arr = ['36','43','38','40','39','42','32','33','34','35','41','37'];
var img = ['imgmain','img1','img2','img3','img4','img5','img6','img7','img8','img9','img10','img11'];
var iCount = 0;
var timer1 = '';

$(function(){
	process2(36)
})

function process2(id){
$.ajax({url: "plugins/realtime/graph_ajax_rt.php?action=init&graph_start=-1800&graph_end=0&local_graph_id=" + id + "&ds_step=5&count=35&sync=on", success: function(result){
        var prm = result.split("!!!");
		document.getElementById(img[iCount]).src = prm[0];
		iCount++;

		if(iCount < arr.length){
			Thumbnail(arr[iCount]);
		}else{
			iCount = 0;
			clearTimeout(timer1);
			setTimeout('process2(36)',15000);
		}
}});
}

function Thumbnail(id){
	timer1 = setTimeout('process2(' + id + ')',2000);
}

</script>
</head>
<body>
<div id="counter"></div>
<table align="center" cellpadding="1" cellspacing="1">
<tr>
	<td align="center"><img id="imgmain" src=""></td>
</tr>
<tr>
	<td align="center">
		<table>
			<tr>
				<td><img id="img1"    src="" ></td>
				<td><img id="img2" src="" ></td>
				<td><img id="img3" src="" ></td>
				<td><img id="img4" src="" ></td>
			</tr>
			<tr>
				<td><img id="img5" src="" ></td>
				<td><img id="img6"   src="" ></td>
				<td><img id="img7"   src="" ></td>
				<td><img id="img8" src="" ></td>
			</tr>
			<tr>
				<td><img id="img9" src="" ></td>
				<td><img id="img10" src="" ></td>
				<td><img id="img11" src="" ></td>
				<td></td>
			</tr>
		</table>
	</td>
</tr>
</table>
</body>
</html>

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests