]> arthur.barton.de Git - netdata.git/commitdiff
report running uid and euid when not running properly
authorCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Sun, 29 Jan 2017 20:01:16 +0000 (22:01 +0200)
committerCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Sun, 29 Jan 2017 20:01:16 +0000 (22:01 +0200)
configs.signatures
src/apps_plugin.c

index 9a435dfcceafad3c4e8ccf67b4237664b33e1a72..7941280eabed1d9969b82943a28c2c67481c64d8 100644 (file)
@@ -331,6 +331,7 @@ declare -A configs_signatures=(
   ['d8dc489e32f7114c6298fce94e86a8ef']='health.d/entropy.conf'
   ['d9036091e2232fc2b8bfa8c7484dea28']='apps_groups.conf'
   ['d9258e671d0d0b6498af1ce16ef030d2']='apps_groups.conf'
+  ['d9fa0290cdfe4153188bb52dd31191df']='apps_groups.conf'
   ['da29d2ab1ab7b8fda189960c840e5144']='health.d/swap.conf'
   ['dad303c5cca7a69345811a01a74f5892']='health.d/net.conf'
   ['dc0d2b96378f290eec3fcf98b89ad824']='python.d/cpufreq.conf'
index b71588763fe664c24fa119278fd21bd48fb682d1..cfb2298a04622096a63286e15cc0b28adc12371e 100644 (file)
@@ -3135,23 +3135,26 @@ int main(int argc, char **argv) {
 
     parse_args(argc, argv);
 
-    if(!am_i_running_as_root())
-        if(!check_capabilities())
+    if(!am_i_running_as_root()) {
+        if(!check_capabilities()) {
+            uid_t uid = getuid(), euid = geteuid();
 #ifdef HAVE_CAPABILITY
-            error("apps.plugin should either run as root or have special capabilities. "
+            error("apps.plugin should either run as root (now running with uid %u, euid %u) or have special capabilities. "
                           "Without these, apps.plugin cannot report disk I/O utilization of other processes. "
-                          "To enable capabilities run: sudo setcap cap_dac_read_search,cap_sys_ptrace+ep %1$s; "
-                          "To enable setuid to root run: sudo chown root %1$s; sudo chmod 4755 %1$s; "
-                  , argv[0]
+                          "To enable capabilities run: sudo setcap cap_dac_read_search,cap_sys_ptrace+ep %s; "
+                          "To enable setuid to root run: sudo chown root %s; sudo chmod 4755 %s; "
+                  , uid, euid, argv[0], argv[0], argv[0]
             );
 #else
-            error("apps.plugin should either run as root or have special capabilities. "
+            error("apps.plugin should either run as root (now running with uid %u, euid %u) or have special capabilities. "
                           "Without these, apps.plugin cannot report disk I/O utilization of other processes. "
                           "Your system does not support capabilities. "
-                          "To enable setuid to root run: sudo chown root %1$s; sudo chmod 4755 %1$s; "
-                  , argv[0]
+                          "To enable setuid to root run: sudo chown root %s; sudo chmod 4755 %s; "
+                  , uid, euid, argv[0], argv[0]
             );
 #endif
+        }
+    }
 
     all_pids_sortlist = callocz(sizeof(pid_t), (size_t)pid_max);
     all_pids          = callocz(sizeof(struct pid_stat *), (size_t) pid_max);