[collectd] Collectd and Otus Project

2011-03-17 Thread Geraldo Neto
Good afternoon, 

I'm very interested about DISC systems and how to monitor them. I intend to use 
all those concepts to my researches in masters.
I met Otus Project in Google Code. Reading some files of this project, I found 
something like Collected daemon. I got a bit confused: Did Otus Project 
generate 
Collected daemon? If not, what the difference between them? Is there a Final 
Version of Otus available for download?


Thank you!
 ==

Geraldo A Sarmento Nt
MSc Candidate on Computer Science at Federal University of Campina Grande - UFCG
Distributed Systems Laboratory
Paraíba - Brazil
==


  ___
collectd mailing list
collectd@verplant.org
http://mailman.verplant.org/listinfo/collectd


[collectd] [PATCH] Plugin cpu - added CPU percent and summary usage

2011-03-17 Thread Vladimir I. Umnov
Added HZ and for all systems numcpu defaults to 1. Now jiffies multiplied to 
100/HZ.
In sysctl capable systems HZ extracted from kern.clockrate stathz. In linux 
it's sysconf(_SC_CLK_TCK); For other systems it's defaults to 100 for now.

Added config options
Plugin cpu
PerCpuStatistic true
ScaleTo100  false
/Plugin

Now summary CPU statistic always collected (it's more usefull than percore).
PerCpuStatistic - also collect data for each cpu
ScaleTo100 - scale summary cpu data to 100% (divide by numcpu).
---
 src/cpu.c |  209 +
 1 files changed, 155 insertions(+), 54 deletions(-)

diff --git a/src/cpu.c b/src/cpu.c
index 12071a2..6f533e6 100644
--- a/src/cpu.c
+++ b/src/cpu.c
@@ -113,7 +113,6 @@ static int cpu_temp_retry_max = 1;
 /* #endif PROCESSOR_CPU_LOAD_INFO */
 
 #elif defined(KERNEL_LINUX)
-/* no variables needed */
 /* #endif KERNEL_LINUX */
 
 #elif defined(HAVE_LIBKSTAT)
@@ -121,15 +120,14 @@ static int cpu_temp_retry_max = 1;
 # define MAX_NUMCPU 256
 extern kstat_ctl_t *kc;
 static kstat_t *ksp[MAX_NUMCPU];
-static int numcpu;
+//static int numcpu;
 /* #endif HAVE_LIBKSTAT */
 
 #elif CAN_USE_SYSCTL
-static int numcpu;
 /* #endif CAN_USE_SYSCTL */
 
 #elif defined(HAVE_SYSCTLBYNAME)
-static int numcpu;
+//static int numcpu;
 #  ifdef HAVE_SYSCTL_KERN_CP_TIMES
 static int maxcpu;
 #  endif /* HAVE_SYSCTL_KERN_CP_TIMES */
@@ -141,10 +139,48 @@ static int maxcpu;
 
 #elif defined(HAVE_PERFSTAT)
 static perfstat_cpu_t *perfcpu;
-static int numcpu;
+//static int numcpu;
 static int pnumcpu;
 #endif /* HAVE_PERFSTAT */
 
+static const char *config_keys[] =
+{
+   PerCpuStatistic,
+   ScaleTo100,
+   NULL
+};
+static int config_keys_num = 2;
+
+static int numcpu = 1;
+static bool per_cpu_statistic = false;
+static bool scale = true;
+static int hz=100;
+
+
+static int cpu_config (const char *key, const char *value)
+{
+   if (strcasecmp (key, PerCpuStatistic) == 0)
+   {
+   if (IS_TRUE (value))
+ per_cpu_statistic = true;
+else
+per_cpu_statistic = false;
+   }
+   else if (strcasecmp (key, ScaleTo100) == 0)
+   {
+   if (IS_TRUE (value))
+scale = true;
+else
+scale = false;
+   }
+   else
+   {
+   return (-1);
+   }
+
+   return (0);
+}
+
 static int init (void)
 {
 #if PROCESSOR_CPU_LOAD_INFO || PROCESSOR_TEMPERATURE
@@ -199,6 +235,21 @@ static int init (void)
sstrerror (errno, errbuf, sizeof (errbuf)));
return (-1);
}
+
+struct clockinfo ci;
+   size_t ci_size = sizeof (ci);
+   int mib[2] = {CTL_KERN, KERN_CLOCKRATE};
+
+   status = sysctl (mib, STATIC_ARRAY_SIZE (mib),
+   ci, ci_size, NULL, 0);
+   if (status == -1)
+   {
+   char errbuf[1024];
+   WARNING (cpu plugin: sysctl: %s,
+   sstrerror (errno, errbuf, sizeof (errbuf)));
+   return (-1);
+   }
+hz = ci.stathz;
 /* #endif CAN_USE_SYSCTL */
 
 #elif defined (HAVE_SYSCTLBYNAME)
@@ -214,6 +265,17 @@ static int init (void)
return (-1);
}
 
+struct clockinfo ci;
+   size_t ci_size = sizeof (ci);
+   if (sysctlbyname (kern.clockrate, ci, ci_size, NULL, 0)  0)
+   {
+   char errbuf[1024];
+   WARNING (cpu plugin: sysctlbyname(kern.clockrate): %s,
+   sstrerror (errno, errbuf, sizeof (errbuf)));
+   return (-1);
+   }
+hz = ci.stathz;
+
 #ifdef HAVE_SYSCTL_KERN_CP_TIMES
numcpu_size = sizeof (maxcpu);
 
@@ -238,6 +300,11 @@ static int init (void)
/* nothing to initialize */
 #endif /* HAVE_PERFSTAT */
 
+#if defined(KERNEL_LINUX)
+numcpu = sysconf( _SC_NPROCESSORS_ONLN );
+hz = sysconf(_SC_CLK_TCK);
+#endif /* KERNEL_LINUX */
+
return (0);
 } /* int init */
 
@@ -246,13 +313,20 @@ static void submit (int cpu_num, const char 
*type_instance, derive_t value)
value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
 
-   values[0].derive = value;
+if (hz != 100)
+   values[0].derive = (derive_t) (value * (100.0 / hz));
+else
+   values[0].derive = value;
+
+if (scale  cpu_num  0)
+values[0].derive = values[0].derive / numcpu;
 
vl.values = values;
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, cpu, sizeof (vl.plugin));
-   ssnprintf (vl.plugin_instance, sizeof (vl.plugin_instance),
+if (cpu_num = 0)
+   ssnprintf (vl.plugin_instance, sizeof (vl.plugin_instance),
%i, cpu_num);
sstrncpy (vl.type, cpu, sizeof (vl.type));
sstrncpy 

Re: [collectd] Simple Tail plugin regex -- count lines

2011-03-17 Thread Bob.Boldin
Martin,

  The part I struggled with at first is the data is going to be converted into 
a rate - so the number represents Transactions per second.  I found on my use 
of tail I needed to increase the polling interval so that enough transactions 
were caught between polls to actually create meaningful data points.

In the global section I went to:
Interval 300

10,000 records in an hour would still only be 3 tps

In my tail match section using:
  DSType CounterInc
  Type invocations

Hope it helps

Bob

-Original Message-
From: collectd-boun...@verplant.org [mailto:collectd-boun...@verplant.org] On 
Behalf Of Martin B. Smith
Sent: Monday, March 14, 2011 11:54 AM
To: collectd@verplant.org
Subject: [collectd] Simple Tail plugin regex -- count lines

Hi all,

I've been struggling with the regex and/or dstype of the tail plugin. 
I'm basically wanting to count lines in an audit file that logs 
authentications. Any line should match. Here's what I've got:

LoadPlugin tail
Plugin tail
   File /var/log/shibboleth-idp/idp-audit.log
 Instance idp_audit_log
 Match
   Regex .*
   DSType CounterInc
   Type derive
   Instance urn_ufl_edu
 /Match
   /File
/Plugin

I know that the log has more lines in it, since I can run this command 
and see the line count jump dramatically even in just a few seconds:

$ cat /var/log/shibboleth-idp/idp-audit.log  | wc -l

Unfortunately, when I dump the rrd, I get AVERAGE values like:

!-- 2011-03-14 11:15:00 EDT / 1300115700 -- rowv 1.915600e+00 
/v/row
!-- 2011-03-14 11:20:00 EDT / 1300116000 -- rowv 1.963867e+00 
/v/row
!-- 2011-03-14 11:25:00 EDT / 1300116300 -- rowv 2.103644e+00 
/v/row
!-- 2011-03-14 11:30:00 EDT / 1300116600 -- rowv 1.989200e+00 
/v/row
!-- 2011-03-14 11:35:00 EDT / 1300116900 -- rowv 1.953467e+00 
/v/row

I *know* I'm seeing more than 1-2 lines in a 5 minute interval. Is it 
possible the numbers are too large that I'm substracting, yielding an 
overflow? A single hour can sometimes have 10k lines in the log file.

Thanks in advance for your consideration!
-- 
Martin B. Smith
smit...@ufl.edu - (352) 273-1374
CNS/Open Systems Group
University of Florida


___
collectd mailing list
collectd@verplant.org
http://mailman.verplant.org/listinfo/collectd


Re: [collectd] NetApp plugin giving NANs

2011-03-17 Thread Sven Trenkel

On 15.03.2011 12:40, Mark Syms wrote:

Hi,


I've been trying to use the NetApp plugin to monitor a NetApp Fas2020
that I'm working with. Collectd is running on Debian, I've built a
modified package of version 4.10.1-1 using the NetApp SDK to allow
enabling the NetApp plugin. The NetApp is running version 7.2.6.1 of the
system software.

rrdtool info for the cpu-system.rrd file gives the following (the other
RRDs are similar).


what interval did you configure for the NetApp plugin? There used to be 
a bug that caused this kind of behavior if the global interval was 
different from the interval used by the netapp plugin. If this error 
condition fits your setup, you might want to update to version 4.10.2. 
After this you have to delete all empty rrd files of the netapp plugin, 
as they have been created with with the wrong interval setting.


If updating is not an option for whatever reason you can adjust the
interval of the netapp plugin to your global interval, which should fix
the problem immediately. Or, if you know a lot more about rrd than I do,
you could edit the already created rrd files and adjust their update
interval, but I have no idea how to do that. But someone else on this 
mailing list might be able to answer this question.



Regards,
Sven

___
collectd mailing list
collectd@verplant.org
http://mailman.verplant.org/listinfo/collectd


Re: [collectd] [Bug 734179] collectd runs as root unnecessarily

2011-03-17 Thread Florian Forster
Hi Andrew and Sebastian,

On Sun, Mar 13, 2011 at 02:39:06PM +0100, Sebastian Harl wrote:
 With this E-mail, I'm also submitting this as wishlist bug report to
 the Debian BTS and I'm going to fix it in my next upload.

I would have liked to answer to that bug as well, but couldn't find it
on bugs.debian.org. Am I missing something?

On Sun, Mar 13, 2011 at 07:04:39AM -, Andrew Yates wrote:
 (It might also be a good idea to run collectd as an unprivileged user
 by default. A quick test suggests that of the default plugins only
 'df' may require root privileges.)

In the vast majority of cases, the df plugin doesn't need privileges.
The only problematic case I can think of right now is if some file
system is mounted at /secret/foo and the unprivileged user isn't
allowed to read /secret.

Plugins which do require privileges can be found in the collectd wiki in
the Plugins requiring privileges category [0].

Regards,
—octo

[0] http://collectd.org/wiki/index.php/Category:Plugins_requiring_privileges
-- 
Florian octo Forster
Hacker in training
GnuPG: 0x0C705A15
http://octo.it/


signature.asc
Description: Digital signature
___
collectd mailing list
collectd@verplant.org
http://mailman.verplant.org/listinfo/collectd