summaryrefslogtreecommitdiff
path: root/FS/bin/freeside-check
blob: 9930aae6cc096d2044609f68370f9c116bdf8212 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/perl
#!/usr/bin/perl -w

use strict;
use FS::UID qw( adminsuidsetup );
use FS::Cron::check qw(
  check_queued check_selfservice check_apache check_bop_failures
  check_sg check_sg_login check_sgng
  alert error_msg
);

my $user = shift or die &usage;
my @emails = @ARGV;
#die "no notification email given" unless @emails;

eval { adminsuidsetup $user };

if ( $@ ) { alert("Database down: $@", @emails); exit; }

check_queued       or alert('Queue daemon not running', @emails);
check_selfservice  or alert(error_msg(), @emails);
check_apache       or alert('Apache not running: '. error_msg(), @emails);

#no-ops unless you are sg
my $sg = 'FS::ClientAPI::SG';
check_sg           or alert("$sg not responding: ".     error_msg(), @emails);
check_sg_login     or alert("$sg login errort: ".       error_msg(), @emails);
check_sgng         or alert("${sg}NG not responding: ". error_msg(), @emails);

check_bop_failures or alert(error_msg(), @emails);