[Nagiosplug-devel] Please can I have GIT access
Thomas Guyot-Sionnest
dermoth at aei.ca
Tue Sep 1 17:22:38 CEST 2009
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Holger Weiß wrote:
> * Alain Williams <addw at phcomp.co.uk> [2009-08-29 12:12]:
>> Please give me a GIT account.
>
> I'd be more than happy to see new team members who have the motiviation,
> time, and skills to look into other people's bug reports and to review
> and test their patches. But asking for Git access in order to be able
> to push your own stuff before a consensus was reached is quite a
> different pair of shoes. While I do have Git access, I would not
> (ab)use it to push any patch of mine without seriously addressing such
> concerns from Thomas and Matthias.
Moreover you're free to create a fork on repo.or.cz and push your
patches there. We will merge your tree if patches are acceptable and
this will save us time. Having Git access on the main repo wouldn't help
any more getting patches in because we'd revert unacceptable patches anyway.
Back to the data retention debate, I agree if we go that way functions
could be used for state retention. Another thing we could consider
(although I believe you don't like it much) is shared memory...
Finally I believe there's another method that should be considered, and
although people are usually not very used to it it's pretty elegant
IMHO. Just open two file descriptors for the plugin to use, one for
reading in state and one for saving it. This could be done by Nagios
and, for older Nagios versions or passive checks, a simple wrapper could
be used to save the data to a file. Here's a Quick'nDirty(tm) example:
$ cat test.pl
#!/usr/bin/perl
use strict;
use warnings;
use Storable qw(store_fd retrieve_fd);
my %state;
read_state();
$state{'counter'} += 1;
print "Current counter: $state{'counter'}\n";
write_state();
sub read_state {
open(STATE_RFD,"<&=3") || die "couldn't open read fd: $!";
eval { %state = %{retrieve_fd(\*STATE_RFD)}; };
close(STATE_RFD);
}
sub write_state {
open(STATE_WFD,">&=4") || die "couldn't open write fd: $!";
store_fd(\%state,*STATE_WFD);
close(STATE_WFD);
}
$
$ touch state; ./test.pl 3<state 4>state.new; mv state.new state
Current counter: 1
$ touch state; ./test.pl 3<state 4>state.new; mv state.new state
Current counter: 2
$ touch state; ./test.pl 3<state 4>state.new; mv state.new state
Current counter: 3
$ touch state; ./test.pl 3<state 4>state.new; mv state.new state
Current counter: 4
This is very flexible because if gives the caller the choice of where to
write data to while using a simple and standard interface for using it.
- --
Thomas
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAkqdPD4ACgkQ6dZ+Kt5BchaEBACfaIXTJlX5MAGVIDuJ6OIH8+uv
BJUAoM3odMZtYSuVFXz88ZnobSZBScvI
=a6T+
-----END PGP SIGNATURE-----
More information about the Devel
mailing list