#include "collectd.h"
#include "common.h"
#include "plugin.h"
-#include "utils_debug.h"
#include "configfile.h"
/* Include header files for the mach system, if they exist.. */
{
if (pse->age > 10)
{
- DBG ("Removing this procstat entry cause it's too old: "
+ DEBUG ("Removing this procstat entry cause it's too old: "
"id = %lu; name = %s;",
pse->id, ps->name);
&pset_list,
&pset_list_len)) != KERN_SUCCESS)
{
- syslog (LOG_ERR, "host_processor_sets failed: %s\n",
+ ERROR ("host_processor_sets failed: %s\n",
mach_error_string (status));
pset_list = NULL;
pset_list_len = 0;
#elif KERNEL_LINUX
pagesize_g = sysconf(_SC_PAGESIZE);
- DBG ("pagesize_g = %li; CONFIG_HZ = %i;",
+ DEBUG ("pagesize_g = %li; CONFIG_HZ = %i;",
pagesize_g, CONFIG_HZ);
#endif /* KERNEL_LINUX */
vl.values_len = 2;
plugin_dispatch_values ("ps_pagefaults", &vl);
- DBG ("name = %s; num_proc = %lu; num_lwp = %lu; vmem_rss = %lu; "
+ DEBUG ("name = %s; num_proc = %lu; num_lwp = %lu; vmem_rss = %lu; "
"vmem_minflt_counter = %lu; vmem_majflt_counter = %lu; "
"cpu_user_counter = %lu; cpu_system_counter = %lu;",
ps->name, ps->num_proc, ps->num_lwp, ps->vmem_rss,
if ((dh = opendir (dirname)) == NULL)
{
- DBG ("Failed to open directory `%s'", dirname);
+ DEBUG ("Failed to open directory `%s'", dirname);
return (NULL);
}
{
if (list != NULL)
free (list);
- syslog (LOG_ERR, "processes plugin: "
+ ERROR ("processes plugin: "
"Failed to allocate more memory.");
return (NULL);
}
fields_len = strsplit (buffer, fields, 64);
if (fields_len < 24)
{
- DBG ("`%s' has only %i fields..",
+ DEBUG ("`%s' has only %i fields..",
filename, fields_len);
return (-1);
}
else if (fields_len != 41)
{
- DBG ("WARNING: (fields_len = %i) != 41", fields_len);
+ DEBUG ("WARNING: (fields_len = %i) != 41", fields_len);
}
/* copy the name, strip brackets in the process */
name_len = strlen (fields[1]) - 2;
if ((fields[1][0] != '(') || (fields[1][name_len + 1] != ')'))
{
- DBG ("No brackets found in process name: `%s'", fields[1]);
+ DEBUG ("No brackets found in process name: `%s'", fields[1]);
return (-1);
}
fields[1] = fields[1] + 1;
if ((tasks = ps_read_tasks (pid)) == NULL)
{
/* This happends for zombied, e.g. */
- DBG ("ps_read_tasks (%i) failed.", pid);
+ DEBUG ("ps_read_tasks (%i) failed.", pid);
*state = 'Z';
ps->num_lwp = 0;
ps->num_proc = 0;
/* Leave the rest at zero if this is only an LWP */
if (ps->num_proc == 0)
{
- DBG ("This is only an LWP: pid = %i; name = %s;",
+ DEBUG ("This is only an LWP: pid = %i; name = %s;",
pid, ps->name);
return (0);
}
strncpy (name, kp.kp_proc.p_comm, name_max_len - 1);
name[name_max_len - 1] = '\0';
- DBG ("pid = %i; name = %s;", *pid, name);
+ DEBUG ("pid = %i; name = %s;", *pid, name);
/* We don't do the special handling for `p_comm == "LaunchCFMApp"' as
* `top' does it, because it is a lot of work and only used when
pset_list[pset],
&port_pset_priv)) != KERN_SUCCESS)
{
- syslog (LOG_ERR, "host_processor_set_priv failed: %s\n",
+ ERROR ("host_processor_set_priv failed: %s\n",
mach_error_string (status));
continue;
}
&task_list,
&task_list_len)) != KERN_SUCCESS)
{
- syslog (LOG_ERR, "processor_set_tasks failed: %s\n",
+ ERROR ("processor_set_tasks failed: %s\n",
mach_error_string (status));
mach_port_deallocate (port_task_self, port_pset_priv);
continue;
&task_basic_info_len);
if (status != KERN_SUCCESS)
{
- syslog (LOG_ERR, "task_info failed: %s",
+ ERROR ("task_info failed: %s",
mach_error_string (status));
continue; /* with next thread_list */
}
&task_events_info_len);
if (status != KERN_SUCCESS)
{
- syslog (LOG_ERR, "task_info failed: %s",
+ ERROR ("task_info failed: %s",
mach_error_string (status));
continue; /* with next thread_list */
}
&task_absolutetime_info_len);
if (status != KERN_SUCCESS)
{
- syslog (LOG_ERR, "task_info failed: %s",
+ ERROR ("task_info failed: %s",
mach_error_string (status));
continue; /* with next thread_list */
}
* thread is nonsense, since the task/process
* is dead. */
zombies++;
- DBG ("task_threads failed: %s",
+ DEBUG ("task_threads failed: %s",
mach_error_string (status));
if (task_list[task] != port_task_self)
mach_port_deallocate (port_task_self,
&thread_data_len);
if (status != KERN_SUCCESS)
{
- syslog (LOG_ERR, "thread_info failed: %s",
+ ERROR ("thread_info failed: %s",
mach_error_string (status));
if (task_list[task] != port_task_self)
mach_port_deallocate (port_task_self,
* There's only zombie tasks, which are
* handled above. */
default:
- syslog (LOG_WARNING,
- "Unknown thread status: %s",
+ WARNING ("Unknown thread status: %s",
thread_data.run_state);
break;
} /* switch (thread_data.run_state) */
status = mach_port_deallocate (port_task_self,
thread_list[thread]);
if (status != KERN_SUCCESS)
- syslog (LOG_ERR, "mach_port_deallocate failed: %s",
+ ERROR ("mach_port_deallocate failed: %s",
mach_error_string (status));
}
} /* for (thread_list) */
thread_list_len * sizeof (thread_act_t)))
!= KERN_SUCCESS)
{
- syslog (LOG_ERR, "vm_deallocate failed: %s",
+ ERROR ("vm_deallocate failed: %s",
mach_error_string (status));
}
thread_list = NULL;
status = mach_port_deallocate (port_task_self,
task_list[task]);
if (status != KERN_SUCCESS)
- syslog (LOG_ERR, "mach_port_deallocate failed: %s",
+ ERROR ("mach_port_deallocate failed: %s",
mach_error_string (status));
}
(vm_address_t) task_list,
task_list_len * sizeof (task_t))) != KERN_SUCCESS)
{
- syslog (LOG_ERR, "vm_deallocate failed: %s",
+ ERROR ("vm_deallocate failed: %s",
mach_error_string (status));
}
task_list = NULL;
if ((status = mach_port_deallocate (port_task_self, port_pset_priv))
!= KERN_SUCCESS)
{
- syslog (LOG_ERR, "mach_port_deallocate failed: %s",
+ ERROR ("mach_port_deallocate failed: %s",
mach_error_string (status));
}
} /* for (pset_list) */
if ((proc = opendir ("/proc")) == NULL)
{
- syslog (LOG_ERR, "Cannot open `/proc': %s", strerror (errno));
+ ERROR ("Cannot open `/proc': %s", strerror (errno));
return (-1);
}
status = ps_read_process (pid, &ps, &state);
if (status != 0)
{
- DBG ("ps_read_process failed: %i", status);
+ DEBUG ("ps_read_process failed: %i", status);
continue;
}