Révision 17f78427
Whitespace cleanup
- remove trailing whitespace
- remove empty lines at the end of files
| plugins/boinc/boinc_processes | ||
|---|---|---|
| 5 | 5 |
# Parameters: |
| 6 | 6 |
# |
| 7 | 7 |
# password -- The password for RPC authentication |
| 8 |
# (default: boinc_cmd will look for a file
|
|
| 8 |
# (default: boinc_cmd will look for a file |
|
| 9 | 9 |
# 'gui_rpc_auth.cfg' and use the password in it) |
| 10 | 10 |
# host -- the host to connect to (default: localhost) |
| 11 | 11 |
# port -- optional (default: 31416) |
| 12 | 12 |
# |
| 13 |
# This plugin can monitor boinc processes running on local/remote machines.
|
|
| 13 |
# This plugin can monitor boinc processes running on local/remote machines. |
|
| 14 | 14 |
# You can see the progress on various projects. |
| 15 | 15 |
# |
| 16 | 16 |
# Author: Petr Ruzicka <petr.ruzicka@gmail.com> |
| ... | ... | |
| 49 | 49 |
|
| 50 | 50 |
$reply =~ /<nonce>(.*)<\/nonce>/; |
| 51 | 51 |
$hash = md5_hex($1, $password); |
| 52 |
|
|
| 52 |
|
|
| 53 | 53 |
print $client "<boinc_gui_rpc_request><auth2><nonce_hash>$hash</nonce_hash></auth2></boinc_gui_rpc_request>\003"; |
| 54 |
|
|
| 54 |
|
|
| 55 | 55 |
{
|
| 56 | 56 |
local $/ = "\003"; |
| 57 | 57 |
$reply = <$client>; |
| 58 | 58 |
} |
| 59 |
|
|
| 59 |
|
|
| 60 | 60 |
if ($reply =~ /<authorized\/>/) {
|
| 61 | 61 |
print "yes\n"; |
| 62 | 62 |
exit 0; |
| ... | ... | |
| 70 | 70 |
my $client = IO::Socket::INET->new ( PeerAddr => $host, |
| 71 | 71 |
PeerPort => $port, |
| 72 | 72 |
Proto => 'tcp' ) |
| 73 |
or die "Can't bind : $@\n";
|
|
| 73 |
or die "Can't bind : $@\n"; |
|
| 74 | 74 |
|
| 75 | 75 |
print $client "<boinc_gui_rpc_request><auth1/></boinc_gui_rpc_request>\003"; |
| 76 | 76 |
|
| 77 |
{
|
|
| 77 |
{
|
|
| 78 | 78 |
local $/ = "\003"; |
| 79 | 79 |
$reply = <$client>; |
| 80 | 80 |
} |
| 81 | 81 |
|
| 82 | 82 |
$reply =~ /<nonce>(.*)<\/nonce>/; |
| 83 | 83 |
my $hash = md5_hex($1, $password); |
| 84 |
|
|
| 84 |
|
|
| 85 | 85 |
print $client "<boinc_gui_rpc_request><auth2><nonce_hash>$hash</nonce_hash></auth2></boinc_gui_rpc_request>\003"; |
| 86 |
|
|
| 86 |
|
|
| 87 | 87 |
{
|
| 88 | 88 |
local $/ = "\003"; |
| 89 | 89 |
$reply = <$client>; |
| 90 | 90 |
} |
| 91 |
|
|
| 91 |
|
|
| 92 | 92 |
if ($reply !~ /<authorized\/>/) {
|
| 93 | 93 |
die "Wrong password: $_"; |
| 94 | 94 |
} |
| 95 |
|
|
| 95 |
|
|
| 96 | 96 |
print $client "<boinc_gui_rpc_request><get_state></boinc_gui_rpc_request>"; |
| 97 | 97 |
|
| 98 | 98 |
while (chomp($reply = <$client>) && ($reply ne "</boinc_gui_rpc_reply>")) {
|
| ... | ... | |
| 101 | 101 |
print "graph_category htc\n"; |
| 102 | 102 |
print "graph_args -l 0\n"; |
| 103 | 103 |
print "graph_vlabel %\n"; |
| 104 |
}
|
|
| 104 |
} |
|
| 105 | 105 |
if ($reply =~ /<project_name>(.*)<\/project_name>/) {
|
| 106 | 106 |
my $boinc_munin_name=$1; |
| 107 | 107 |
$boinc_munin_name =~ /(\w+).*/; |
| ... | ... | |
| 115 | 115 |
my $client = IO::Socket::INET->new ( PeerAddr => $host, |
| 116 | 116 |
PeerPort => $port, |
| 117 | 117 |
Proto => 'tcp' ) |
| 118 |
or die "Can't bind : $@\n";
|
|
| 118 |
or die "Can't bind : $@\n"; |
|
| 119 | 119 |
|
| 120 | 120 |
print $client "<boinc_gui_rpc_request><auth1/></boinc_gui_rpc_request>\003"; |
| 121 | 121 |
|
| 122 |
{
|
|
| 122 |
{
|
|
| 123 | 123 |
local $/ = "\003"; |
| 124 | 124 |
$reply = <$client>; |
| 125 | 125 |
} |
| 126 | 126 |
|
| 127 | 127 |
$reply =~ /<nonce>(.*)<\/nonce>/; |
| 128 | 128 |
my $hash = md5_hex($1, $password); |
| 129 |
|
|
| 129 |
|
|
| 130 | 130 |
print $client "<boinc_gui_rpc_request><auth2><nonce_hash>$hash</nonce_hash></auth2></boinc_gui_rpc_request>\003"; |
| 131 |
|
|
| 131 |
|
|
| 132 | 132 |
{
|
| 133 | 133 |
local $/ = "\003"; |
| 134 | 134 |
$reply = <$client>; |
| 135 | 135 |
} |
| 136 |
|
|
| 136 |
|
|
| 137 | 137 |
if ($reply !~ /<authorized\/>/) {
|
| 138 | 138 |
die "Wrong password: $_"; |
| 139 | 139 |
} |
| 140 |
|
|
| 140 |
|
|
| 141 | 141 |
print $client "<boinc_gui_rpc_request><get_state></boinc_gui_rpc_request>"; |
| 142 |
|
|
| 142 |
|
|
| 143 | 143 |
while (chomp($reply = <$client>) && ($reply ne "</boinc_gui_rpc_reply>")) {
|
| 144 | 144 |
if ($reply =~ /<project_name>(\w+).*<\/project_name>/) {
|
| 145 | 145 |
$project = $1; |
Formats disponibles : Unified diff