monitors:boinc

no way to compare when less than two revisions

Differences

This shows you the differences between two versions of the page.


monitors:boinc [2009/11/23 05:36] (current) – created - external edit 127.0.0.1
Line 1: Line 1:
 +====== BOINC ======
 +
 +^ Author | [[ andrew@eiknet.com | Andrew Rankin ]] |
 +^ Compatibility | Xymon 4.2 |
 +^ Requirements | Perl, Date::Format, Linux |
 +^ Download | http://eiknet.com/bb-boinc.pl.bz2 |
 +^ Last Update | 2007-09-26 |
 +
 +===== Description =====
 +
 +Boinc Monitoring script - This is for monitoring the boinc (Berkeley Open Infrastructure for Network Computing, http://boinc.berkeley.edu/).  Assuming you have your client setup for RPC, you can use the boinc_cmd command to check current status.  This script uses the output from that command to create output for hobbit.
 +
 +===== Installation =====
 +=== Client side ===
 +
 +- Install bb-boinc.pl into the <client_root>/ext/ directory
 +- Modify bb-boinc.pl setting the hostname, domain, hobbit_server, boinc_passwd, bbtmp & bbhome variables
 +- Modify your clientlaunch.cfg, adding:
 +<code>
 +  [boinc]
 +          ENVFILE $HOBBITCLIENTHOME/etc/hobbitclient.cfg
 +          CMD $HOBBITCLIENTHOME/ext/bb-boinc.pl
 +          LOGFILE $HOBBITCLIENTHOME/logs/hobbitclient.log
 +          INTERVAL 5m
 +</code>
 +=== Server side ===
 +
 +- For NCV Graphs:
 +  - hobbitgraph.cfg, add:<code>
 +[boinc]
 +        TITLE Average BOINC Credit for USER
 +        YAXIS Credit
 +        DEF:credit=boinc.rrd:userexpavgcredit:AVERAGE
 +        LINE2:credit#00CC00:Average User Credit
 +        GPRINT:credit:LAST: \: %5.1lf (cur)
 +        GPRINT:credit:MAX: \: %5.1lf (max)
 +        GPRINT:credit:MIN: \: %5.1lf (min)
 +        GPRINT:credit:AVERAGE: \: %5.1lf (avg)\n
 +
 +[boinc1]
 +        TITLE Total BOINC Credit for USER
 +        YAXIS Credit
 +        DEF:credit=boinc.rrd:usertotalcredit:AVERAGE
 +        LINE2:credit#00CC00:Total User Credit
 +        GPRINT:credit:LAST: \: %5.1lf (cur)
 +        GPRINT:credit:MAX: \: %5.1lf (max)
 +        GPRINT:credit:MIN: \: %5.1lf (min)
 +        GPRINT:credit:AVERAGE: \: %5.1lf (avg)\n
 +</code>
 +  - hobbitserver.cfg, you'll be modifying TEST2RRD and GRAPHS and adding a variable named NCV_boinc:<code>
 +TEST2RRD="[...],boinc=ncv"
 +GRAPHS="[...],boinc"
 +NCV_boinc="*:GAUGE,name:NONE,masterURL:NONE,user_name:NONE,team_name:NONE"
 +</code>
 +  - bb-hosts, add the following to add the boinc info to the trends coloumn:<code>
 +TRENDS:*,[...],boinc:boinc|boinc1
 +</code>
 +
 +===== Source =====
 +==== bb-boinc.pl ====
 +<hidden onHidden="Show Code ⇲" onVisible="Hide Code ⇱">
 +<code perl>
 +#!/usr/bin/perl -w
 +#############################################################################
 +#
 +# Written by Andrew Rankin (andrew [at] eiknet.com)
 +# boinc client monitoring script
 +#
 +#############################################################################
 +use strict;
 +
 +## variables 
 +##############################################################################
 +my $bbtmp = '/usr/lib64/hobbit/client/tmp';
 +my $bbhome = '/usr/lib64/hobbit/client';
 +my $bbtest = 'boinc';
 +my $boinc_passwd = 'PASSWD';
 +my $hobbit_server = 'server.domain.com';
 +my $machine = "machine,domain,com"; # Use commas not periods
 +my $boinc_path = "/usr/bin"; #path to your BOINC install
 +
 +## BB and related test constants
 +#############################################################################
 +
 +use constant GREEN  => 'green';
 +use constant YELLOW => 'yellow';
 +use constant RED    => 'red';
 +
 +#############################################################################
 +{
 +    my $DATA = "";
 +    my $color = GREEN;
 +    my $status = 'boinc OK';
 +    my %project_info;
 +
 +## Get Main Project Info
 +    my $boinc_output = `$boinc_path/boinc_cmd --passwd $boinc_passwd --get_state 2>&1`;
 +
 +    if($boinc_output =~ m/Connection refused/g){
 + $color = RED;
 + $status = 'boinc NOT RUNNING';
 +    }
 +    elsif($boinc_output =~ m/Authorization failure/g){
 + $color = RED;
 +        $status = 'boinc ERROR';
 +    }
 +    else {
 + my @boinc_sections = split(/======== .* ========/, $boinc_output);
 + my ($projects,$crap) = split(/GUI URL:/, $boinc_sections[1], 2);
 + $projects =~ s/\'//g;
 + $projects =~ s/1\) -----------\n//g;
 +
 + my @project_lines = split(/\n/,$projects);
 + foreach my $line (@project_lines){
 +     chomp($line);
 +     my ($key,$value) = split /: /, $line,2;
 +     next if !$key or !$value;
 +     $key =~ s/ //g;
 +
 +     # rid us of horrid decimal places
 +     if($key =~ m/(resourceshare|user_total_credit|user_expavg_credit|host_total_credit|host_expavg_credit|diskusage|lastRPC|projectfilesdownloaded)/){
 + $value = int($value);
 +     }
 +     # change yes/no to 1/0
 +     if($value =~ m/no/i){
 + $value = 0;
 +     }
 +     if($value =~ m/yes/i){
 + $value = 1;
 +     }
 +
 +     $project_info{$key} = $value;
 +     $DATA .= "$key: $value\n";
 + }
 +    }
 +
 +##########################################
 +    my $report_date = `date`;
 +
 +    system("$bbhome/bin/bb $hobbit_server 'status $machine.$bbtest $color $report_date - $status\n\n$DATA'\n");
 +}
 +
 +#############################################################################
 +</code>
 +</hidden>
 +
 +===== Known  Bugs and Issues =====
 +
 +===== To Do =====
 +
 +===== Credits =====
 +  * Andrew Rankin
 +
 +===== Changelog =====
 +
 +  * **2007-09-26**
 +    * Initial release
  
  • monitors/boinc.txt
  • Last modified: 2009/11/23 05:36
  • by 127.0.0.1