2 # Copyright (c) 2013 Index Data ApS, http://indexdata.com
4 # irspy-nagios.pl - check if IRSpy updates run
15 my $update_cycle_days = 7;
16 my $url = 'http://irspy.indexdata.com/raw.html?id=Z39.50%3Aopencontent.indexdata.com%3A210%2Foaister';
22 --debug=0..2 debug option, default: $debug
23 --days=1..7 alert if older than days, default $update_cycle_days
24 --url=URL url to check, default $url
30 ##################################################################
35 "days=i" => \$update_cycle_days,
42 die "No data for $url\n" if !defined $data;
43 warn $data if $debug >= 2;
45 if ($data =~ m,<dateModified>(.*?)</dateModified>,) {
47 my $time = str2time($date);
49 my $last_update = time() - $time;
50 warn "last update: $last_update seconds ago\n" if $debug;
52 if ($last_update > 24*3600* $update_cycle_days) {
53 die "Last update is older than $last_update seconds: $date\n";
57 die "cannot parse date field <dateModified> from $url\n";