[luci] collectd exec plugin

Omer Munchik Omer.Munchik at alvarion.com
Thu Oct 30 17:08:38 CET 2014


Hi,

In luci-statistics application, I am using collectd to collect several
metrics on my machine.

For this purpose I used the exec plugin of collectd to write a script
that collects  the goodput (tx and rx) of all associated stations.

 

The issue is: every associated station adds a new .rrd file to /tmp/rrd.

I would like to only keep the latest 100 rrd file, and automatically
delete older files.

 For this matter I am using the notification command of the exec plugin.
I am running the following script:

 

1:   #!/bin/sh

2:   # remove all files in the notified dir expect for the 100 newest
files

3:   dir_name=$(echo "${header}`cat -`" | grep rrd)

4:   ls -d -1 $dir_name/*.* | sed -e '1,100d'  | xargs log_file.sh

5:   ls -d -1 $dir_name/*.* | sed -e '1,100d'  | xargs rm

 

This script creates a list  of the "old files", prints the list to log
(line 4) and removes them (line 5).

The problem is that this is not working. The files are not removed with
rm, although printing the files list to the log works ok (so this is not
a syntax problem).

 

Do you have a suggestion where the issue may by?

Initially I thought it was a permission problem, so I tried running the
script with "root:root", rather than "nouser:nogroup". But this caused
the  script not to run altogether.

I also tried manually changing the permission of the files. This didn't
work either.

 

Any ideas?

 

Thanks,

Omer


************************************************************************************ 
This footnote confirms that this email message has been scanned by 
PineApp Mail-SeCure for the presence of malicious code, vandals & computer viruses(42). 
************************************************************************************


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.subsignal.org/pipermail/luci/attachments/20141030/30fded6d/attachment.html>


More information about the luci mailing list