PDA

View Full Version : UserParamater's Delimiting $1 Variables....


edeus
19-12-2005, 03:46
I have the following statement:

UserParameter=myitem,ps auxw | awk '$5 ~ /^[0-9]*$/ { s+= $5} END {print s}'

The parameter's $5 are getting passed even though they are null.

I tried delimiting with all combinations I could think of, but nothing works.

the only way around this is to have a script but this is a real nuisance and not very pretty.

another option I had was to use nested ...`echo $`5... but that is seriously dodgy also.

Can anyone help me please???

edeus
19-12-2005, 04:14
Also,

Multiple parameters do not appear to be working.

UserParameter=areca[],/usr/local/sbin/areca-info $1 $2

Called via ... -k"areca[raidinfo,1]" and gives me ZBX_NOTSUPPORTED.

I have tried various things to get it working, in a test parameter it worked once but I couldnt change it's syntax nor could I establish a reason why it was working and this one above wasnt.

Wasted enough time trying to figure this one out, i hope someone else got a little further or could explain why this is happening.

alphamerik
19-12-2005, 16:25
Edeus,

I think you are missing the *, maybe it should be:

UserParameter=areca ,/usr/local/sbin/areca-info $1 $2

Let me know if this works...

edeus
20-12-2005, 00:01
From speculation/other user's responses, the documentation/notes are incorrect. It currently works without any * in the brackets [].

I think I tried this just in case though :)

edeus
20-12-2005, 00:03
Revision 1.914 - (view) (download) (annotate) - [select for diffs]
Thu Dec 15 09:11:00 2005 UTC (4 days, 13 hours ago) by osmiy
Branch: MAIN
CVS Tags: HEAD
Changes since 1.913: +3 -0 lines
Diff to previous 1.913

- fixed system.swap.size (Eugene)
- fixed vm.memory.size (Eugene)
- fixed configuration file parsing for user specifed functions (Eugene)

Looks there are a few things that are fixed (all of which I have noticed/had problems with).

edeus
20-12-2005, 02:10
Yes! Multiple parameters works again!

I cant say I like using the CVS version. I hope they fix the ping issue soon, it probably would be easy enough to fix by hand though.

Fixed problem with using $6 etc nested variables by adding a space, awk doesnt seem to care.