processes plugin: Added some more error- and debug-messages.
authorFlorian Forster <octo@leeloo.lan.home.verplant.org>
Sat, 17 Jun 2006 18:33:18 +0000 (20:33 +0200)
committerFlorian Forster <octo@leeloo.lan.home.verplant.org>
Sat, 17 Jun 2006 18:33:18 +0000 (20:33 +0200)
Mostly to play with the merging of git, though ;)

src/processes.c

index fae1c2d..dba29ef 100644 (file)
@@ -161,6 +161,9 @@ static void ps_submit (int running,
                                blocked) >= BUFSIZE)
                return;
 
+       DBG ("running = %i; sleeping = %i; zombies = %i; stopped = %i; paging = %i; blocked = %i;",
+                       running, sleeping, zombies, stopped, paging, blocked);
+
        plugin_submit (MODULE_NAME, "-", buf);
 }
 
@@ -369,12 +372,15 @@ static void ps_read (void)
 
                if ((fh = fopen (filename, "r")) == NULL)
                {
-                       syslog (LOG_ERR, "Cannot open `%s': %s", filename, strerror (errno));
+                       syslog (LOG_NOTICE, "Cannot open `%s': %s", filename,
+                                       strerror (errno));
                        continue;
                }
 
                if (fgets (buf, BUFSIZE, fh) == NULL)
                {
+                       syslog (LOG_NOTICE, "Unable to read from `%s': %s",
+                                       filename, strerror (errno));
                        fclose (fh);
                        continue;
                }
@@ -382,7 +388,10 @@ static void ps_read (void)
                fclose (fh);
 
                if (strsplit (buf, fields, BUFSIZE) < 3)
+               {
+                       DBG ("Line has less than three fields.");
                        continue;
+               }
 
                switch (fields[2][0])
                {
@@ -395,7 +404,7 @@ static void ps_read (void)
                }
        }
 
-       closedir(proc);
+       closedir (proc);
 
        ps_submit (running, sleeping, zombies, stopped, paging, blocked);
 #endif /* KERNEL_LINUX */