Ah, I fumbled sending the correct stanza.  The rule which concerns me is 
actually this one:


type=SingleWithSuppress
ptype=regexp
pattern=T(\d\d:\d\d:\d\d)\-\d\d:\d\d (.*?) .*gmp.info.c.* new group:.* 
down:\s+(.*?),\s
desc=Down Nodes: $3
window=5
action=lcall %node $3 -> ( sub { $arrayid_to_lnn{$_[0]} } );\
  if %node (write /home/tocops/.tocpipe ops $1 $2 Down Nodes: %node) else ( 
write /home/tocops/.tocpipe ops $1 $2 Down Nodes: $3)
#action=write /home/tocops/.tocpipe ops $1 $2 Down Nodes: $3

Recall that the syslog line looks like this:
2017-08-03T06:07:31-07:00 isilon-cluster-10 /boot/kernel.amd64/kernel: 
[gmp_info.c:1863](pid 38910="kt: gmp-config")(tid=103609) new group: <3,2302>: 
{ 3-6:0-34, 8:0-20,22-31,33-34,36-37, 9:1-21,24, 10-11:0-21, 12-13:0-34, 
18:0-21, 21:0-34, 22:0-21, 24:0-34, down: 23, smb: 3-6,8-13,18,21-22,24, nfs: 
3-6,8-13,18,21-22,24, all_enabled_protocols: 3-6,8-13,18,21-22,24 }
So I claim that $3 is, in fact, set to ‘23’ – I have confirmation on this 
because my management application (which reads /home/tocops/.tocpipe) posts the 
following to its interface:

06:07:31 isilon-cluster-10 Down Nodes: 23

I speculate that the ‘else’ clause executed, which would produce this result.

So I claim I’m back to:

  *   I don’t understand why “sub { $arrayid_to_lnn{23} “ does not return ‘7’
  *   And more generically, what approaches would you suggest to 
trouble-shooting action lines, plus embedded Perl?
     *   Is there a way to add print statements, for example?  I am imagining 
something like:



action=lcall %node $3 -> ( sub { print “I got $_[0]\n”; $arrayid_to_lnn{$_[0]} 
} );\

  if %node (write /home/tocops/.tocpipe ops $1 $2 Down Nodes: %node) else ( 
write /home/tocops/.tocpipe ops $1 $2 Down Nodes: $3)


     *   Other suggestions for adding debug / trace / print information to the 
execution of action statements?

[BTW:  thank you for pointing out that the example I posted – about drives 
changing to ‘up’ – won’t work – I had blindly copied my ‘Down Node’ approach to 
the ‘Drive Change’ stanzas – I will go back and fix this.]

--sk



From: Risto Vaarandi [mailto:risto.vaara...@gmail.com]
Sent: Friday, August 04, 2017 1:01 PM
To: Stuart Kendrick <stua...@alleninstitute.org>
Cc: simple-evcorr-users@lists.sourceforge.net
Subject: Re: [Simple-evcorr-users] look-up a string in a hash, then write hash 
value

I create a rule which uses %arrayid_to_lnn to translate Array ID into LNN

# Handle Isilon node down messages
type=SingleWithSuppress
ptype=regexp
pattern=T(\d\d:\d\d:\d\d)\-\d\d:\d\d (.*?) .*gmp.info.c.* group change:.* (node 
\d+ drive \d+ changed to up)
desc=Drive Recover:  $3
action=lcall %node $3 -> ( sub { $arrayid_to_lnn{$_[0]} } );\
  if %node (write /home/tocops/.tocpipe ops $1 $2 Drive Recover: %node) else ( 
write /home/tocops/.tocpipe ops $1 $2 Drive Recover: $3)
window=5

Recall that the syslog line of interest might look as follows:

2017-08-03T06:07:31-07:00 isilon-cluster-10 /boot/kernel.amd64/kernel: 
[gmp_info.c:1863](pid 38910="kt: gmp-config")(tid=103609) new group: <3,2302>: 
{ 3-6:0-34, 8:0
-20,22-31,33-34,36-37, 9:1-21,24, 10-11:0-21, 12-13:0-34, 18:0-21, 21:0-34, 
22:0-21, 24:0-34, down: 23, smb: 3-6,8-13,18,21-22,24, nfs: 
3-6,8-13,18,21-22,24, all_enabled_protocols: 3-6,8-13,18,21-22,24 }

The 3rd match in the pattern grabs the Array ID, i.e. ‘23’ in the log line 
above.

I am quite afraid it is not possible, since the regular expression of the above 
rule reads as follows:

T(\d\d:\d\d:\d\d)\-\d\d:\d\d (.*?) .*gmp.info.c.* group change:.* (node \d+ 
drive \d+ changed to up)
There are 3 capture groups in this expression, and the third one which sets $3 
reads as follows:
(node \d+ drive \d+ changed to up)
Unfortunately, this capture group does not set $3 to a numeral, but rather to a 
string "node X drive Y changed to up".
Since you don't have any value in %attayid_to_lnn with such a key, the %node 
variable gets set to an empty string.
kind regards,
risto

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Simple-evcorr-users mailing list
Simple-evcorr-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/simple-evcorr-users

Reply via email to