ceph / ceph-nagios-plugins

Nagios plugins for Ceph
Apache License 2.0
81 stars 80 forks source link

check_ceph_mds: check_target_mds: handle if _get_active_mds return None #52

Closed k0ste closed 5 years ago

k0ste commented 5 years ago

This PR fix #41

before:

# ./check_ceph_mds --name ceph-mds0 --filesystem fs
Traceback (most recent call last):
  File "./check_ceph_mds", line 184, in <module>
    sys.exit(main())
  File "./check_ceph_mds", line 103, in main
    return check_target_mds(mds_stat, args.filesystem, args.name)
  File "./check_ceph_mds", line 118, in check_target_mds
    for mds in active_mdss:
TypeError: 'NoneType' object is not iterable

after:

# ./check_ceph_mds --name ceph-mds0 --filesystem fs
MDS ERROR: FS 'fs' is not found in fsmap

Because my fs name is not fs

# ./check_ceph_mds --name ceph-mds0 --filesystem cephfs
MDS OK: MDS 'ceph-mds0' is up:active
k0ste commented 5 years ago

@valerytschopp

valerytschopp commented 5 years ago

@k0ste thanks for the fix