X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fceph.c;h=b186a276335d1b7e8867a1b170ff864845f4a83e;hb=f43d1b843bc886fa4180d505a216a3f5c64b2d41;hp=cbfdd22c39e4da5f3314b497bea1cc67834bb88d;hpb=e6798095bb2f063dd97619399575fef3e0fe501e;p=collectd.git diff --git a/src/ceph.c b/src/ceph.c index cbfdd22c..b186a276 100644 --- a/src/ceph.c +++ b/src/ceph.c @@ -38,6 +38,9 @@ #if HAVE_YAJL_YAJL_VERSION_H #include #endif +#ifdef HAVE_SYS_CAPABILITY_H +# include +#endif #include #include @@ -1525,6 +1528,7 @@ static int cconn_main_loop(uint32_t request_type) if(revents == 0) { /* do nothing */ + continue; } else if(cconn_validate_revents(io, revents)) { @@ -1573,6 +1577,22 @@ static int ceph_read(void) static int ceph_init(void) { int ret; + +#if defined(HAVE_SYS_CAPABILITY_H) && defined(CAP_DAC_OVERRIDE) + if (check_capability (CAP_DAC_OVERRIDE) != 0) + { + if (getuid () == 0) + WARNING ("ceph plugin: Running collectd as root, but the " + "CAP_DAC_OVERRIDE capability is missing. The plugin's read " + "function will probably fail. Is your init system dropping " + "capabilities?"); + else + WARNING ("ceph plugin: collectd doesn't have the CAP_DAC_OVERRIDE " + "capability. If you don't want to run collectd as root, try running " + "\"setcap cap_dac_override=ep\" on the collectd binary."); + } +#endif + ceph_daemons_print(); ret = cconn_main_loop(ASOK_REQ_VERSION);