[collectd] where to write data from external script

Sebastian Harl sh at tokkee.org
Tue Feb 3 11:57:44 CET 2009


Hi Stefan,

On Tue, Feb 03, 2009 at 11:37:25AM +0100, Stefan Arn wrote:
> I want to monitor how many discs are marked as online on my raid
> controller. So far I use a commandline tool for that. I wrote a little
> shell script which returns:
> 
> PUTVAL localhost/raid/discs N:2
> 
> Nummer 2 is the actual number of the discs online. the rest is from
> your documentation, though I think the raid/discs part is wrong.

"raid" is fine - this is just some arbitrary string that's supposed to
help you identify the data. Usually, that part is of the form <plugin>-
<plugin_instance>, so in this case, this could e.g. be exec-raid ("exec"
is the name of the plugin) but this is just convention - collectd does
not care about that at all as long as it's unique (if it's not, you'll
get error messages like "uc_update: Value too old" in the logs).

"discs" identifies the layout of the data you're dispatching to
collectd, so an arbitrary string won't work here. See the types.db(5)
manpage for more details about how to define data types. In your case,
you'd want a GAUGE type, since your values do not continuously increase.
You could either use a generic, pre-defined type like "gauge" or define
your own type in a second types.db file and add that file to the
"TypesDB" config option _in_ _addition_ to the default types.db file.
So, your line might e.g. look like that:

  PUTVAL localhost/exec-raid/gauge N:2

> Further I added the exec plugin and configured it to work with my script:
> 
> LoadPlugin exec
> <Plugin exec>
>         Exec "root:root" "/opt/MegaRAID/MegaCli/raiddiscsonline.sh"
> </Plugin>

That won't work - the exec plugin refuses to execute a script as root.
If you need additional privileges, e.g. use sudo in your script. Else,
that config looks fine.

HTH,
Sebastian

-- 
Sebastian "tokkee" Harl +++ GnuPG-ID: 0x8501C7FC +++ http://tokkee.org/

Those who would give up Essential Liberty to purchase a little Temporary
Safety, deserve neither Liberty nor Safety.         -- Benjamin Franklin

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20090203/5aa901f6/attachment.pgp 


More information about the collectd mailing list