generator monitor instance. Args: mtype: type of monitor Returns: monitor instance.
(mtype)
| 451 | |
| 452 | |
| 453 | def get_monitor(mtype): |
| 454 | """ generator monitor instance. |
| 455 | |
| 456 | Args: |
| 457 | mtype: type of monitor |
| 458 | |
| 459 | Returns: |
| 460 | monitor instance. |
| 461 | """ |
| 462 | if mtype == 'ftp': |
| 463 | return FTPMonitor( |
| 464 | args.ftp_host, |
| 465 | args.ftp_port, |
| 466 | username=args.ftp_username, |
| 467 | password=args.ftp_password, |
| 468 | interval=args.interval) |
| 469 | elif mtype == 'general': |
| 470 | return GeneralMonitor(args.general_host, interval=args.interval) |
| 471 | elif mtype == 'afs' or mtype == 'hdfs': |
| 472 | return HadoopMonitor( |
| 473 | args.hadoop_bin, args.fs_name, args.fs_ugi, interval=args.interval) |
| 474 | else: |
| 475 | raise Exception('unsupport type.') |
| 476 | |
| 477 | |
| 478 | def start_monitor(monitor, args): |
no test coverage detected