real time get system data :return:
()
| 292 | diskIO["write"] = disks_after.write_bytes - disks_before.write_bytes |
| 293 | |
| 294 | def get_realtime_data(): |
| 295 | ''' |
| 296 | real time get system data |
| 297 | :return: |
| 298 | ''' |
| 299 | t1 = threading.Thread( |
| 300 | target=_ping_thread, |
| 301 | kwargs={ |
| 302 | 'host': CU, |
| 303 | 'mark': '10010', |
| 304 | 'port': PROBEPORT |
| 305 | } |
| 306 | ) |
| 307 | t2 = threading.Thread( |
| 308 | target=_ping_thread, |
| 309 | kwargs={ |
| 310 | 'host': CT, |
| 311 | 'mark': '189', |
| 312 | 'port': PROBEPORT |
| 313 | } |
| 314 | ) |
| 315 | t3 = threading.Thread( |
| 316 | target=_ping_thread, |
| 317 | kwargs={ |
| 318 | 'host': CM, |
| 319 | 'mark': '10086', |
| 320 | 'port': PROBEPORT |
| 321 | } |
| 322 | ) |
| 323 | t4 = threading.Thread( |
| 324 | target=_net_speed, |
| 325 | ) |
| 326 | t5 = threading.Thread( |
| 327 | target=_disk_io, |
| 328 | ) |
| 329 | for ti in [t1, t2, t3, t4, t5]: |
| 330 | ti.daemon = True |
| 331 | ti.start() |
| 332 | |
| 333 | def _monitor_thread(name, host, interval, type): |
| 334 | # 参考 _ping_thread 风格:每轮解析一次目标,按协议族偏好解析 IP,测 TCP 建连耗时 |