Project

General

Profile

« Previous | Next » 

Revision f6c2c75d

Added by Lucas Held over 5 years ago

support variable value length in queue stats parser

(cherry picked from commit e5deede539e4164256e5243b22f3ee963fc35ea7)

View differences:

src/etc/inc/shaper.inc
282 282
			$interfacestats[$currentqueueif][$currentqueuename] = &$newqueue;
283 283
		} else {
284 284
			if ($items[3] == "pkts:") {
285
				$newqueue["pkts"] = trim(substr($line, 10, 10));
286
				$newqueue["bytes"] = trim(substr($line, 29, 10));
287
				$newqueue["droppedpkts"] = trim(substr($line, 55, 6));
288
				$newqueue["droppedbytes"] = trim(substr($line, 69, 6));
285
				$pktsquery = "pkts:";
286
				$pktsstart = strpos($line, $pktsquery);
287
				$pktsend = $pktsstart + strlen($pktsquery);
288

  
289
				$bytesquery = "bytes:";
290
				$bytesstart = strpos($line, $bytesquery);
291
				$bytesend = $bytesstart + strlen($bytesquery);
292

  
293
				$droppedpktsquery = "dropped pkts:";
294
				$droppedpktsstart = strpos($line, $droppedpktsquery);
295
				$droppedpktsend = $droppedpktsstart + strlen($droppedpktsquery);
296

  
297
				$droppedbytesquery = "bytes:";
298
				$droppedbytesstart = strpos($line, $droppedbytesquery, $droppedpktsend);
299
				$droppedbytesend = $droppedbytesstart + strlen($droppedbytesquery);
300

  
301
				$newqueue["pkts"] = trim(substr($line, $pktsend, $bytesstart-$pktsend));
302
				$newqueue["bytes"] = trim(substr($line, $bytesend, $droppedpktsstart-$bytesend));
303
				$newqueue["droppedpkts"] = trim(substr($line, $droppedpktsend, $droppedbytesstart-$droppedpktsend));
304
				$newqueue["droppedbytes"] = trim(substr($line, $droppedbytesend, strlen($line)-1-$droppedbytesend));
289 305
			}
290 306
			if ($items[3] == "qlength:") {
291 307
				$subitems = explode("/", substr($line, 13, 8));

Also available in: Unified diff