|
5 | 5 |
|
6 | 6 | $name = 'apache';
|
7 | 7 | $app_id = $app['app_id'];
|
8 |
| -if (!empty($agent_data['app'][$name])) { |
| 8 | +if (! empty($agent_data['app'][$name])) { |
9 | 9 | $apache = $agent_data['app'][$name];
|
10 | 10 | } else {
|
11 | 11 | $options = '-Oqv';
|
12 |
| - $oid = '.1.3.6.1.4.1.8072.1.3.2.3.1.2.6.97.112.97.99.104.101'; |
13 |
| - $apache = snmp_get($device, $oid, $options); |
| 12 | + $oid = '.1.3.6.1.4.1.8072.1.3.2.3.1.2.6.97.112.97.99.104.101'; |
| 13 | + $apache = snmp_get($device, $oid, $options); |
14 | 14 | }
|
15 | 15 |
|
16 | 16 | echo ' apache';
|
17 | 17 |
|
18 |
| -list ($total_access, $total_kbyte, $cpuload, $uptime, $reqpersec, $bytespersec, |
| 18 | +[$total_access, $total_kbyte, $cpuload, $uptime, $reqpersec, $bytespersec, |
19 | 19 | $bytesperreq, $busyworkers, $idleworkers, $score_wait, $score_start,
|
20 | 20 | $score_reading, $score_writing, $score_keepalive, $score_dns,
|
21 |
| - $score_closing, $score_logging, $score_graceful, $score_idle, $score_open) = explode("\n", $apache); |
| 21 | + $score_closing, $score_logging, $score_graceful, $score_idle, $score_open] = explode("\n", $apache); |
22 | 22 |
|
23 |
| -$rrd_name = array('app', $name, $app_id); |
| 23 | +$rrd_name = ['app', $name, $app_id]; |
24 | 24 | $rrd_def = RrdDefinition::make()
|
25 | 25 | ->addDataset('access', 'DERIVE', 0, 125000000000)
|
26 | 26 | ->addDataset('kbyte', 'DERIVE', 0, 125000000000)
|
|
43 | 43 | ->addDataset('sb_idle', 'GAUGE', 0, 125000000000)
|
44 | 44 | ->addDataset('sb_open', 'GAUGE', 0, 125000000000);
|
45 | 45 |
|
46 |
| -$fields = array( |
47 |
| - 'access' => intval(trim($total_access, '"')), |
48 |
| - 'kbyte' => $total_kbyte, |
49 |
| - 'cpu' => $cpuload, |
50 |
| - 'uptime' => $uptime, |
51 |
| - 'reqpersec' => $reqpersec, |
52 |
| - 'bytespersec' => $bytespersec, |
53 |
| - 'byesperreq' => $bytesperreq, |
54 |
| - 'busyworkers' => $busyworkers, |
55 |
| - 'idleworkers' => $idleworkers, |
56 |
| - 'sb_wait' => $score_wait, |
57 |
| - 'sb_start' => $score_start, |
58 |
| - 'sb_reading' => $score_reading, |
59 |
| - 'sb_writing' => $score_writing, |
60 |
| - 'sb_keepalive' => $score_keepalive, |
61 |
| - 'sb_dns' => $score_dns, |
62 |
| - 'sb_closing' => $score_closing, |
63 |
| - 'sb_logging' => $score_logging, |
64 |
| - 'sb_graceful' => $score_graceful, |
65 |
| - 'sb_idle' => $score_idle, |
66 |
| - 'sb_open' => intval(trim($score_open, '"')), |
67 |
| -); |
| 46 | +$fields = [ |
| 47 | + 'access' => intval(trim($total_access, '"')), |
| 48 | + 'kbyte' => $total_kbyte, |
| 49 | + 'cpu' => $cpuload, |
| 50 | + 'uptime' => $uptime, |
| 51 | + 'reqpersec' => $reqpersec, |
| 52 | + 'bytespersec' => $bytespersec, |
| 53 | + 'byesperreq' => $bytesperreq, |
| 54 | + 'busyworkers' => $busyworkers, |
| 55 | + 'idleworkers' => $idleworkers, |
| 56 | + 'sb_wait' => $score_wait, |
| 57 | + 'sb_start' => $score_start, |
| 58 | + 'sb_reading' => $score_reading, |
| 59 | + 'sb_writing' => $score_writing, |
| 60 | + 'sb_keepalive' => $score_keepalive, |
| 61 | + 'sb_dns' => $score_dns, |
| 62 | + 'sb_closing' => $score_closing, |
| 63 | + 'sb_logging' => $score_logging, |
| 64 | + 'sb_graceful' => $score_graceful, |
| 65 | + 'sb_idle' => $score_idle, |
| 66 | + 'sb_open' => intval(trim($score_open, '"')), |
| 67 | +]; |
68 | 68 |
|
69 | 69 | $tags = compact('name', 'app_id', 'rrd_name', 'rrd_def');
|
70 | 70 | data_update($device, 'app', $tags, $fields);
|
|
0 commit comments