Changeset 26


Ignore:
Timestamp:
Feb 13, 2008, 12:32:42 PM (16 years ago)
Author:
george
Message:

Přidány další měřící funkce.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • measure_scripts/traffic.php

    r25 r26  
    4545  while(strpos($Row, '  ') !== false) $Row = str_replace('  ', ' ', $Row);
    4646  $RowParts = explode(' ', $Row);
    47   return($RowParts[2]); 
     47  $Row = $Output[3];
     48  while(strpos($Row, '  ') !== false) $Row = str_replace('  ', ' ', $Row);
     49  $RowParts2 = explode(' ', $Row);
     50  return($RowParts[2] + $RowParts2[2]); 
    4851}
    4952
     
    114117}
    115118
     119function TeamSpeak()
     120{
     121  $Output = array();
     122  exec('cat /proc/net/nf_conntrack|grep "dst=192.168.0.14 "|grep "dport=8767 "', $Output);
     123  return(count($Output));
     124}
     125
    116126$URL = $Config['AddNewValueUrl'];
    117127//GetNetworkStat();
     
    185195  file_get_contents($URL.'?MeasureId=16&Value='.$Value);
    186196 
    187   sleep(60);
     197  // TeamSpeak spojení
     198  $Value = TeamSpeak();
     199  file_get_contents($URL.'?MeasureId=17&Value='.$Value);
     200 
     201  // WoW quests translated count
     202  $Database->select_db('quests');
     203  $DbResult = $Database->query('SELECT ((SELECT count(*) FROM `quests` WHERE Complete = 1 AND Language <> 0) + '.
     204  '(SELECT count(*) FROM `npc_text` WHERE Complete = 1 AND Language <> 0) +'.
     205  '(SELECT count(*) FROM `page_text` WHERE Complete = 1 AND Language <> 0)'.
     206  ') as NumberTranslate');
     207  $Row = $DbResult->fetch_array();
     208  $Value = $Row[0];
     209  file_get_contents($URL.'?MeasureId=18&Value='.$Value);
     210
     211  // Disk utilization
     212  $Output = array();
     213  exec('iostat -d sda -x -m 2 2', $Output);
     214  $Row = $Output[6];
     215  while(strpos($Row, '  ') !== false) $Row = str_replace('  ', ' ', $Row);
     216  $Parts = explode(' ', $Row);
     217  $Value = str_replace(',', '.', $Parts[11]);
     218  //echo('Disk util:'.$Value."\n");
     219  file_get_contents($URL.'?MeasureId=19&Value='.$Value);
     220
     221  sleep(58);  // 60(measure period) - 2(disk utilization)
    188222}
    189223?>
Note: See TracChangeset for help on using the changeset viewer.