X-Git-Url: https://git.octo.it/?p=collectd.git;a=blobdiff_plain;f=src%2Fceph.c;h=e9bb960d9492958992dfabe336b3cfcd1e5d6bea;hp=cbfdd22c39e4da5f3314b497bea1cc67834bb88d;hb=e5e5d99350fa54e22f07b90fbc3102df51565ad9;hpb=6e8d9b2fa6018a1ed1ec8ab3b6551110449a997c diff --git a/src/ceph.c b/src/ceph.c index cbfdd22c..e9bb960d 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 @@ -1573,6 +1576,22 @@ static int ceph_read(void) static int ceph_init(void) { int ret; + +#ifdef HAVE_SYS_CAPABILITY_H + 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);