[collectd] Unix Sock Plugin Issue

Mahendra Kutare mahendra.kutare at gmail.com
Wed Jul 29 13:38:00 CEST 2009


Hi,

I am able to get the earlier issue worked out.

But I have another question in the same context.

I am using Plugin Unixsock so that I can communicate with collectd from outside 
client or script.

I am using collectd-unixsock.py from [collectd.git]/contrib/collectd-unixsock.py

This Python module provides a pure-Python interface for the LISTVAL and GETVAL 
commands. The other commands should be easy to add to this module, too.

Now I try LISTVAL command -

python collectd-unixsock.py LISTVAL and I get correct answers -

1248867099 Domain-0/libvirt/virt_cpu_total ns=7.082219e+06
1248867099 samoa2.cc.gatech.edu/cpu-0/cpu-idle value=9.900000e+01
1248867099 samoa2.cc.gatech.edu/cpu-0/cpu-interrupt value=0.000000e+00
1248867099 samoa2.cc.gatech.edu/cpu-0/cpu-nice value=0.000000e+00
1248867099 samoa2.cc.gatech.edu/cpu-0/cpu-softirq value=0.000000e+00
1248867099 samoa2.cc.gatech.edu/cpu-0/cpu-steal value=0.000000e+00
1248867099 samoa2.cc.gatech.edu/cpu-0/cpu-system value=0.000000e+00
1248867099 samoa2.cc.gatech.edu/cpu-0/cpu-user value=0.000000e+00
1248867099 samoa2.cc.gatech.edu/cpu-0/cpu-wait value=0.000000e+00
1248867099 samoa2.cc.gatech.edu/cpu-1/cpu-idle value=1.000000e+02
1248867099 samoa2.cc.gatech.edu/cpu-1/cpu-interrupt value=0.000000e+00
1248867099 samoa2.cc.gatech.edu/cpu-1/cpu-nice value=0.000000e+00
1248867099 samoa2.cc.gatech.edu/cpu-1/cpu-softirq value=0.000000e+00
1248867099 samoa2.cc.gatech.edu/cpu-1/cpu-steal value=0.000000e+00
1248867099 samoa2.cc.gatech.edu/cpu-1/cpu-system value=0.000000e+00
1248867099 samoa2.cc.gatech.edu/cpu-1/cpu-user value=0.000000e+00
1248867099 samoa2.cc.gatech.edu/cpu-1/cpu-wait value=0.000000e+00
1248867099 samoa2.cc.gatech.edu/cpu-2/cpu-idle value=1.040000e+02
1248867099 samoa2.cc.gatech.edu/cpu-2/cpu-interrupt value=0.000000e+00
1248867099 samoa2.cc.gatech.edu/cpu-2/cpu-nice value=0.000000e+00
1248867099 samoa2.cc.gatech.edu/cpu-2/cpu-softirq value=0.000000e+00
1248867099 samoa2.cc.gatech.edu/cpu-2/cpu-steal value=0.000000e+00
1248867099 samoa2.cc.gatech.edu/cpu-2/cpu-system value=0.000000e+00
1248867099 samoa2.cc.gatech.edu/cpu-2/cpu-user value=0.000000e+00
1248867099 samoa2.cc.gatech.edu/cpu-2/cpu-wait value=0.000000e+00
1248867099 samoa2.cc.gatech.edu/cpu-3/cpu-idle value=1.030000e+02
1248867099 samoa2.cc.gatech.edu/cpu-3/cpu-interrupt value=0.000000e+00
1248867099 samoa2.cc.gatech.edu/cpu-3/cpu-nice value=0.000000e+00
1248867099 samoa2.cc.gatech.edu/cpu-3/cpu-softirq value=0.000000e+00
1248867099 samoa2.cc.gatech.edu/cpu-3/cpu-steal value=0.000000e+00
1248867099 samoa2.cc.gatech.edu/cpu-3/cpu-system value=0.000000e+00
1248867099 samoa2.cc.gatech.edu/cpu-3/cpu-user value=0.000000e+00
1248867099 samoa2.cc.gatech.edu/cpu-3/cpu-wait value=0.000000e+00

But when I try GETVAL samoa2.cc.gatech.edu/cpu-0/cpu-idle
It again simply prints the above output again where as I am expecting name=val pairs.

Is there anything missing in terms of command input ? Is the 
collectd-unixsock.py the correct client to use ?

Thanks
Mahendra


On Wed, 29 Jul 2009, Mahendra Kutare wrote:

> This made it work.
> 
> So we do not need to create the file manually in first place. When I was not doing that it was giving me error No file found.
> 
> Anyways this works now.
> 
> Thanks a lot
> Mahendrra
> On Wed, Jul 29, 2009 at 6:51 AM, Andrés J. Díaz <ajdiaz at connectical.com> wrote:
>       I've the same problem. The easy workarround is deleted the socket
>       manually, I put in the launch script the line rm -f
>       /var/run/collectd-unixsock. The socket will be created again when
>       collectd restart.
>
>       2009/7/29 Mahendra Kutare <mahendra.kutare at gmail.com>:
> >
> >
> > On Tue, Jul 28, 2009 at 11:15 PM, Mahendra Kutare
> > <mahendra.kutare at gmail.com> wrote:
> >>
> >> Hi All,
> >>
> >> I am using collectd 4.5.3 on RHEL5 with Xen 3.1.2.
> >>
> >> I have the following configuration in /etc/collectd.conf file -
> >>
> >> LoadPlugin unixsock
> >>
> >> 400 <Plugin unixsock>
> >> 401     SocketFile "/var/run/collectd-unixsock"
> >> 402     SocketGroup "collectd"
> >> 403     SocketPerms "0775"
> >> 404 </Plugin>
> >>
> >> I created this file /var/run/collectd-unixsock and it has permissions -
> >>
> >> [root at samoa2 collectd 11:14 PM]$ ls -l /var/run/collectd-*
> >> -rw-rw-rw- 1 root root 0 Jul 28 22:43 /var/run/collectd-unixsock
> >>
> >> I also created group collectd and can be seen as -
> >>
> >> [root at samoa2 collectd 11:11 PM]$ cat /etc/group | grep collectd
> >> collectd:x:2731:
> >>
> >> When I start the collectd it shows up in the /var/lib/collectd.log file
> >> the following error -
> >>
> >>  [2009-07-28 23:07:44] unixsock plugin: bind failed: Address already in
> >> use
> >>
> >> Is there anything missing in configuration of unixsock plugin ?
> >
> > I also tried adding Port param in
> >
> > 400 <Plugin unixsock>
> > 401     SocketFile "/var/run/collectd-unixsock"
> >            Port "7634"
> > 402     SocketGroup "collectd"
> > 403     SocketPerms "0775"
> > 404 </Plugin>
> >
> > but it still says in the log file -
> >
> > [2009-07-28 23:18:15] Plugin `unixsock' did not register for value `Port'.
> > [2009-07-28 23:18:15] unixsock plugin: bind failed: Address already in use
> >
> >
> >
> > _______________________________________________
> > collectd mailing list
> > collectd at verplant.org
> > http://mailman.verplant.org/listinfo/collectd
> >
> >
> 
> 
> 
>


More information about the collectd mailing list