【问题标题】:Cacti Thresholds to Send SNMP Trap发送 SNMP 陷阱的 Cacti 阈值
【发布时间】:2015-05-28 22:10:50
【问题描述】:

我最近开始在 Ubuntu 上使用 Cacti 和 Nagios,但我对它们了解有限。当前,当阈值更改时,Cacti 会发送电子邮件。除了当前电子邮件之外,我还希望此阈值发送 SNMP 警报。

我用谷歌搜索了这个,但找不到确切的答案。有什么简单的方法可以存档吗?我是否缺少任何设置或其他内容?

【问题讨论】:

    标签: ubuntu snmp nagios cacti


    【解决方案1】:

    没有简单的方法。您可以将系统日志消息发送到元素管理系统并读取元素管理系统上的系统日志。通过执行以下操作更改 /etc/syslog.conf 以将警报转发到 EMS 系统。

    1. 转到设置 -> 阈值。
    2. 将 Syslog 工具更改为本地 5
    3. 打开 /etc/syslog.conf
    4. 像这样添加远程IP地址 Local5.* @@192.1.3.1:514 您可以根据远程端口更改 514。
    5. 重新启动系统日志。服务系统日志重启
    6. 瞧!检查您是否在远程服务器上接收系统日志。

    艰难的道路。 1.打开thold插件文件夹中的thold_function.php 2.编写一个php函数来发送警报。 3.在logger函数中添加该函数。

    函数记录器($desc, $breach_up, $threshld, $currentval, $trigger, $triggerct, $urlbreach)

    这是您可以修改的代码。

       <?php
    
    // send a trap
    $sourcehost = '123.45.12.3';
    $destinationhost = '1.1.4.6';
    $community = 'public';
    $version = '2c';
    $enterprise = '.1.3.6.1.4.1.99999.11.1';
    $sourcehostname = 'SourceHostName';
    $severity = 4;
    $detail = 'All information about alarm.';
    $message = 'Text to display in alarm summary.';
    
    $uptime = '1001';
    
    
    $billingid              =             76197;
    $period                =             '2014/05/25 22:31:11 -> 2014/05/25 23:01:11';
    $siteid      =             '123456';
    $customer          =             'University of Maryland';
    $cc                         =             380;
    $country             =             'Ukraine';
    $amount             =             '67.05  Euro';
    $minutes            =             '119.73';
    $nrofcalls            =             12;
    
    $command ="snmptrap -v ".$version. " -c ".$community." ".$destinationhost." ".$uptime." ".$enterprise." .1.3.6.1.4.1.99999.222.11.1 s '".$sourcehost."' .1.3.6.1.4.1.99999.222.11.2 s '".$sourcehostname."' .1.3.6.1.4.1.99999.222.11.3 i '".$severity."' .1.3.6.1.4.1.99999.222.11.4 s '".$detail."' .1.3.6.1.4.1.99999.222.11.5 s '".$message."' .1.3.6.1.4.1.99999.222.11.6 s '".$clarifysiteid."' .1.3.6.1.4.1.99999.222.11.7 i '".$billingid."' .1.3.6.1.4.1.99999.222.11.8 s '".$period."' .1.3.6.1.4.1.99999.222.11.9 s '".$customer."' .1.3.6.1.4.1.99999.222.11.10 i '".$cc."' .1.3.6.1.4.1.99999.222.11.11 s '".$country."' .1.3.6.1.4.1.99999.222.11.12 s '".$amount."' .1.3.6.1.4.1.99999.222.11.13 s '".$minutes."' .1.3.6.1.4.1.99999.222.11.14 i ".$nrofcalls;
    
    
    print($command);
    
    system($command);
    
    ?>
    

    【讨论】:

    • 感谢您的回答。我会试试这个方法。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-08-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多