apps.plugin logs the command name on errors
Costa Tsaousis committed
Aug 1, 2016 at 01:54 UTC
3aaf8c11054b2432b2d821bce463050dce5f1e6f
1 file changed
+6
-6
src/apps_plugin.c
+6
-6
@@ -1654,7 +1654,7 @@ void collect_data_for_pid(pid_t pid) {
1654
// /proc/<pid>/stat
1655
1656
if(unlikely(read_proc_pid_stat(p))) {
1657
- error("Cannot process %s/proc/%d/stat", host_prefix, pid);
1657
+ error("Cannot process %s/proc/%d/stat (command '%s')", host_prefix, pid, p->comm);
1658
// there is no reason to proceed if we cannot get its status
1659
return;
1660
}
@@ -1663,7 +1663,7 @@ void collect_data_for_pid(pid_t pid) {
1663
1664
// check its parent pid
1665
if(unlikely(p->ppid < 0 || p->ppid > pid_max)) {
1666
- error("Pid %d states invalid parent pid %d. Using 0.", pid, p->ppid);
1666
+ error("Pid %d (command '%s') states invalid parent pid %d. Using 0.", pid, p->comm, p->ppid);
1667
p->ppid = 0;
1668
}
1669
@@ -1671,13 +1671,13 @@ void collect_data_for_pid(pid_t pid) {
1671
// /proc/<pid>/io
1672
1673
if(unlikely(read_proc_pid_io(p)))
1674
- error("Cannot process %s/proc/%d/io", host_prefix, pid);
1674
+ error("Cannot process %s/proc/%d/io (command '%s')", host_prefix, pid, p->comm);
1675
1676
// --------------------------------------------------------------------
1677
// /proc/<pid>/statm
1678
1679
if(unlikely(read_proc_pid_statm(p))) {
1680
- error("Cannot process %s/proc/%d/statm", host_prefix, pid);
1680
+ error("Cannot process %s/proc/%d/statm (command '%s')", host_prefix, pid, p->comm);
1681
// there is no reason to proceed if we cannot get its memory status
1682
return;
1683
}
@@ -1691,7 +1691,7 @@ void collect_data_for_pid(pid_t pid) {
1691
// /proc/<pid>/cmdline
1692
if(likely(proc_pid_cmdline_is_needed)) {
1693
if(unlikely(read_proc_pid_cmdline(p)))
1694
- error("Cannot process %s/proc/%d/cmdline", host_prefix, pid);
1694
+ error("Cannot process %s/proc/%d/cmdline (command '%s')", host_prefix, pid, p->comm);
1695
}
1696
1697
if(unlikely(debug))
@@ -1729,7 +1729,7 @@ void collect_data_for_pid(pid_t pid) {
1729
// /proc/<pid>/fd
1730
1731
if(unlikely(read_pid_file_descriptors(p))) {
1732
- error("Cannot process entries in %s/proc/%d/fd", host_prefix, pid);
1732
+ error("Cannot process entries in %s/proc/%d/fd (command '%s')", host_prefix, pid, p->comm);
1733
}
1734
1735
// --------------------------------------------------------------------