perl實現異常時報警

2021-04-13 11:20:46 字數 862 閱讀 7107

#!/usr/bin/perl -w

use dbi;

use lwp::****** qw(get);

# $driver="mysql";

$dbh=dbi->connect("dbi:mysql:csunet:localhost","root","")||die"can not connect database";

# 產生當天日期

$year = (gmtime time)[5] + 1900;

$month = (gmtime time)[4] + 1;

$date = (gmtime time)[3];

$today = $year."-".$month."-".$date;

$sql = "select phone from duty_info where riqi='" .$today. "'";

$sth=$dbh->prepare($sql) || die "occur an error when query database!";

$sth->execute();

$numrows=$sth->rows;

while(@row=$sth->fetchrow_array)

if($numrows == 1)

print "滿足條件的數為: $numrows /n";

print $today;

print "/n";

print $sql;

print "/n";

$sth->finish();

$dbh->disconnect();

exit 0;

perl 異常總結

1.pseudo hashes are deprecated the pseudo hashes are deprecated error means you re trying to access an array as a hash,which means that either data or...

Cacti實現MSN報警

一 軟體環境 cacti 需threshold外掛程式 msn機械人 sendmsg 二 安裝過程 cacti的threshold外掛程式參見 cacti配置e mail報警 三 配置過程 1.按照cacti配置e mail報警配置並啟用thold 2.編輯cacti plugins thold t...

open falcon實現郵件報警

2.安裝mail provider 安裝方法 編譯成功之後,修改cfg.json檔案相關資訊,使用 使用curl命令,驗證是否能發郵件,返回success的話就是成功了 curl d tos 你的郵箱 subject 報警測試 content 這是一封測試郵件 success 3.安裝sender ...