[OSM-dev] Auto-testing server status for wiki

Frederik Ramm frederik at remote.org
Mon Feb 26 13:39:31 GMT 2007


Hi,

> We need to think-up a reliable test for each machine (e.g. download a certain 
> file check it's correct) 

Could that not be done using vanilla SNMP monitoring software?

> but I've put together the outline of a script that 
> could upload the results to the wiki.
> 
> http://trac.openstreetmap.org/browser/utils/serverStatus/ServerStatusToWiki.pl
> Comments?

I'd perhaps employ a check along the lines of

my $page = $c->get($Pagename, "rw");
my $lastedit = $page->last_edit();
my $lastedituser = $lastedit->{"user"};
$lastedituser =~ s/<[^>]*>//g;

if ($lastedituser ne "WikiUsername") {
    print "not changing page edited by other user!\n";
} else {
    $page->{"summary"} = "Automatic Update";
    $page->{"content"} = $new_content;
    $page->save();
}

instead of the plain

# Update the wiki page
print $c->text($Pagename, $Data);

to make sure that you don't accidentally overwrite something that 
someone else has put on that page. I know from experience with other 
Wikis that people tend to ignore any warnings about auto-generation and 
add their own content nonetheless ;-)

Bye
Frederik

-- 
Frederik Ramm  ##  eMail frederik at remote.org  ##  N49°00.09' E008°23.33'




More information about the dev mailing list