Horde https://tech.feedyourhead.at/ en Monitoring Horde-Framework-Upgrades using Nagios https://tech.feedyourhead.at/content/monitoring-horde-framework-upgrades-using-nagios <span class="field field--name-title field--type-string field--label-hidden">Monitoring Horde-Framework-Upgrades using Nagios</span> <div class="clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item"><p><a href="http://www.nagios.org" target="_blank"><img alt="" src="http://tech.feedyourhead.at/sites/tech.feedyourhead.at/files/pictures/nagios-logo.jpg" style="float: right;" /></a><a href="http://www.horde.org" target="_blank"><img alt="" src="http://tech.feedyourhead.at/sites/tech.feedyourhead.at/files/pictures/445px-Horde-logo.svg.png" style="width: 325px; height: 131px;" /></a></p> <p>Nagios is an awesome monitoring-tool. I give my best to check as much services as possible with nagios. Here I want to explain how I check if updates for the Horde-Framework exist...</p> <p>Although horde uses pear for update-management I don't want to check pear directly(because of permissions and of course I don't want to create too much traffic on the horde-repository). That's why i use the following cronjob which checks for upgrades once an hour:</p> <pre> <code> 45 * * * * pear list-upgrades > /var/log/pear_check_updates.log </code></pre> <p>Now this nagios-check(check_pear_updates.pl) can use this information:</p> <pre> <code> #!/usr/bin/perl ########################################################################### # # you need a cronjob with this command: # pear list-upgrades > /var/log/pear_check_updates.log # ########################################################################## my $pearchannel = 'Waynes World! Waynes World! Party time! Excellent!'; my @logarr = undef; my $found = 0; my $checkother = 0; my $available_upgrades = 0; my $ret = 2; if($#ARGV < 0) { print "usage: $0 <log-file> [ <pear-channel> ]\n"; exit 3; } my $pearlog = $ARGV[0]; $pearchannel = $ARGV[1] if($#ARGV > 0); unless(open(PEARLOG,"< $pearlog")) { print "Error: can not open logfile: $pearlog\n"; exit 3; } while(<PEARLOG>) { my $tmp = $_; $available_upgrades++ if($tmp =~ /AVAILABLE UPGRADES/); if($tmp =~ /^Channel $pearchannel/) { print $tmp; } else { my @tmparr = split(/\s+/,$tmp); if($tmparr[0] eq $pearchannel) { print "$tmparr[1] $tmparr[2] $tmparr[3] $tmparr[4] $tmparr[5] $tmparr[6],"; $found = 1; } } push(@logarr,$tmp); } close(PEARLOG); exit $ret if($found == 1); if($checkother == 1) { if($available_upgrades > 0) { print "found $available_upgrades other updates than $pearchannel\n"; exit 1; } } exit 0; </code></pre> <p>If we correctly set the permissions for the&nbsp; pear-logfile, our nagios-check can read it.</p> <p><a href="http://tech.feedyourhead.at/content/checkpearupgrade">Here is the download to the full source-code</a></p> </div> <span class="field field--name-uid field--type-entity-reference field--label-hidden"><span lang="" about="/users/hoti" typeof="schema:Person" property="schema:name" datatype="">Hoti</span></span> <span class="field field--name-created field--type-created field--label-hidden">Nov 19 2014</span> <div class="field field--name-field-tagies field--type-entity-reference field--label-above"> <div class="field__label">Tags</div> <div class='field__items'> <div class="field__item"><i class="fa fa-tags"></i> <a href="/Linux" hreflang="en">Linux</a></div> <div class="field__item"><i class="fa fa-tags"></i> <a href="/tags/horde" hreflang="en">Horde</a></div> <div class="field__item"><i class="fa fa-tags"></i> <a href="/Nagios" hreflang="en">Nagios</a></div> <div class="field__item"><i class="fa fa-tags"></i> <a href="/tags/perl" hreflang="en">Perl</a></div> <div class="field__item"><i class="fa fa-tags"></i> <a href="/Programming" hreflang="en">Programming</a></div> </div> </div> <section class="field field--name-comment-node-blog field--type-comment field--label-hidden comment-wrapper"> </section> <section class="field field--name-comment field--type-comment field--label-above comment-wrapper"> <h2 class='title comment-form__title'> <i class="fa fa-comments-o"></i> Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=13&amp;2=comment&amp;3=comment" token="IpQiXavlekgUkoMY55I96KcK_vUoClR5uCQ4Y4laa90"></drupal-render-placeholder> </section> Wed, 19 Nov 2014 13:16:42 +0000 Hoti 13 at https://tech.feedyourhead.at