当前位置: 首页 > 工具软件 > perl-redis > 使用案例 >

Perl 监控Redis

蒋畅
2023-12-01
use Redis;  
use Sys::Hostname;
use HTTP::Date qw(time2iso str2time time2iso time2isoz);  
use Net::SMTP;
sub basic() {
     $host = hostname;
     @lines=qx|/sbin/ifconfig|;
     @ip;
    print "-" x 80 ."\n";
    foreach(@lines){
        if(/inet addr:([\d.]+)/){
            push @ip,$1 unless $1 =~ /\A127.0.0.1\z/;
        }
    }
    print "${yellow}HOST: $host => IP: @ip$normal\n";
    print "-" x 80 ."\n";
};
&basic();
sub send_mail{
if (@_ != 2){print "error\n"};
    ($m,$n) = @_; 
    my $to_address  = $m;
my $CurrTime = time2iso(time());
    my $to_address  = $m;
 my $mail_user   = 'zhaoyangjian@zjcap.cn';
    my $mail_pwd    = 'xxxxx';
    my $mail_server = 'smtp.exmail.qq.com';

    my $from    = "From: $mail_user\n";
    my $subject = "Subject: zjcap info\n";
 类似资料: