Thank you for tip; I have implemented it
--sk
From: Risto Vaarandi [mailto:risto.vaara...@gmail.com]
Sent: Monday, August 07, 2017 2:29 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
2017-08-05 18:15 GMT+03:00 Risto Vaarandi
<risto.vaara...@gmail.com<mailto:risto.vaara...@gmail.com>>:
hi Stuart,
...
For initializing the %arrayid_to_lnn hash, I have used the following rule from
one of your previous posts:
# Global variables
type=Single
ptype=SubStr
pattern=SEC_STARTUP
context=SEC_INTERNAL_EVENT
desc=initialize array-id to node mapping hash
action=lcall %o-> (sub {\
%arrayid_to_lnn = (21 => 1,\
24 => 2,\
3 => 3,\
4 => 4,\
5 => 5,\
6 => 6,\
23 => 7,\
8 => 8,\
9 => 9,\
10 => 10,\
11 => 11,\
12 => 12,\
13 => 13,\
18 => 14,\
22 => 15,\
);\
return 1;\
}\
)
A side note -- if you would like to improve the above rule and reinitialize
%arrayid_to_lnn not only when SEC starts, but also on HUP and ABRT signals, you
could modify the rule as follows:
# Global variables
type=Single
ptype=RegExp
pattern=^(?:SEC_STARTUP|SEC_RESTART|SEC_SOFTRESTART)$
context=SEC_INTERNAL_EVENT
desc=initialize array-id to node mapping hash
action=lcall %o-> (sub {\
%arrayid_to_lnn = (21 => 1,\
24 => 2,\
3 => 3,\
4 => 4,\
5 => 5,\
6 => 6,\
23 => 7,\
8 => 8,\
9 => 9,\
10 => 10,\
11 => 11,\
12 => 12,\
13 => 13,\
18 => 14,\
22 => 15,\
);\
return 1;\
}\
)
That would be lot more practical for production environment, since
modifications can be easily activated with a soft restart (SIGABRT) that
doesn't drop any event correlation information.
kind regards,
risto
2017-08-05 1:18 GMT+03:00 Stuart Kendrick
<stua...@alleninstitute.org<mailto:stua...@alleninstitute.org>>:
>
> 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
>
>
>
>
>
>
------------------------------------------------------------------------------
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