├── README └── yacy /README: -------------------------------------------------------------------------------- 1 | YaCy Monitoring Plugin for Munin 2 | 3 | Requirements 4 | 5 | * XML::Smart ; 6 | * LWP ; 7 | * YacY 8 | -------------------------------------------------------------------------------- /yacy: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -w 2 | # -*- perl -*- 3 | # 4 | # ========================================================================== 5 | # 6 | # YaCy Monitoring Plugin for Munin 7 | # Copyright (C) 2010 Christophe Nowicki 8 | # 9 | # This program is free software; you can redistribute it and/or 10 | # modify it under the terms of the GNU General Public License 11 | # as published by the Free Software Foundation; either version 2 12 | # of the License, or (at your option) any later version. 13 | # 14 | # This program is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with this program; if not, write to the Free Software 21 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 22 | # 23 | # ========================================================================== 24 | # 25 | 26 | =head1 NAME 27 | 28 | yacy - Munin plugin to monitor YaCy distributed search engine network. 29 | 30 | =head1 APPLICABLE SYSTEMS 31 | 32 | YaCy 33 | 34 | =head1 CONFIGURATION 35 | 36 | =head1 INTERPRETATION 37 | 38 | The plugin shows various YaCy Network stats. 39 | 40 | =head1 MAGIC MARKERS 41 | 42 | #%# family=auto 43 | #%# capabilities=autoconf suggest 44 | 45 | =head1 BUGS 46 | 47 | =head1 VERSION 48 | 49 | $Id$ 50 | 51 | =head1 AUTHOR 52 | 53 | Christophe 'CSCMEU' Nowicki 54 | 55 | =head1 LICENSE 56 | 57 | GPLv2 58 | 59 | =cut 60 | 61 | BEGIN { 62 | if(!eval "require XML::Smart;") { 63 | die("XML::Smart not found"); 64 | } 65 | if(!eval "require LWP;") { 66 | die("LWP not found"); 67 | } 68 | } 69 | 70 | use XML::Smart; 71 | use strict; 72 | 73 | my $host = $ENV{'host'} || 'localhost'; 74 | 75 | $0 =~ /yacy_(.+)*$/; 76 | my $action = $1; 77 | 78 | # Autoconf 79 | if ($ARGV[0] and $ARGV[0] eq "autoconf") { 80 | print "yes\n"; 81 | exit; 82 | } 83 | 84 | # Suggest 85 | if ($ARGV[0] and $ARGV[0] eq "suggest") 86 | { 87 | print < 'YaCy Network Online Peers', 106 | network_documents => 'YaCy Network Number of Documents', 107 | network_ppm => 'YaCy Network Indexing Speed Pages Per Minutes', 108 | network_qph => 'YaCy Network Query Frequency Queries Per Hour', 109 | local_documents => 'YaCy Local Number of Documents', 110 | local_ppm => 'YaCy Local Indexing Speed Pages Per Minutes', 111 | local_qph => 'YaCy Local Query Frequency Queries Per Hour', 112 | }; 113 | print <{$action} 115 | graph_info $titles->{$action} 116 | graph_category YaCy 117 | EOF 118 | if ($action =~ /network_(peers|documents)/) { 119 | print <new('http://' . $host . '/Network.xml') or die("PUDDI"); 137 | 138 | if ($action =~ /network_peers/) { 139 | print <{peers}{active}{count} 141 | passive.value $xml->{peers}{passive}{count} 142 | potential.value $xml->{peers}{potential}{count} 143 | EOF 144 | } elsif ($action =~ /network_documents/) { 145 | print <{peers}{active}{links} 147 | passive.value $xml->{peers}{passive}{links} 148 | potential.value $xml->{peers}{potential}{links} 149 | EOF 150 | } elsif ($action =~ /network_ppm/) { 151 | print "ppm.value $xml->{peers}{cluster}{ppm}\n" 152 | } elsif ($action =~ /local_ppm/) { 153 | print "ppm.value $xml->{peers}{your}{ppm}\n" 154 | } elsif ($action =~ /network_qph/) { 155 | print "qph.value $xml->{peers}{cluster}{qph}\n" 156 | } elsif ($action =~ /local_qph/) { 157 | print "qph.value $xml->{peers}{your}{qph}\n" 158 | } elsif ($action =~ /local_documents/) { 159 | print "documents.value $xml->{peers}{your}{links}\n" 160 | } else { 161 | } 162 | 163 | # vim:syntax=perl 164 | --------------------------------------------------------------------------------