AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-31582

Kibet's questions

Martin Hope
Kibet
Asked: 2010-03-03 06:11:42 +0800 CST

是否有 Nagios 插件可让您在检查 URL 时指定引荐来源网址?

  • 2

我想监视站点 A,如果请求来自站点 B,则仅接受对某个 URL 的请求。我知道Wget可以选择下载受引荐来源网址保护的内容,如下所示

wget --referer=http://first_page http://second_page

是否有任何Nagios插件可以实现这一点,或者check_http是否能够做到这一点?

nagios
  • 1 个回答
  • 514 Views
Martin Hope
Kibet
Asked: 2010-01-21 01:24:46 +0800 CST

是否有任何 nagios 插件或工具可以以很酷的方式查看性能报告?

  • 4

我们让 Nagios 监控我们的 Web 服务器、邮件服务器和网络设备,我想知道是否有人会推荐一个好的插件或工具,它使用 Nagios 数据以一种像样的方式创建关于主机和服务的清晰性能报告。我想到的是图形、图表等。

nagios
  • 4 个回答
  • 2367 Views
Martin Hope
Kibet
Asked: 2010-01-15 01:11:46 +0800 CST

Nagios 通知定义

  • 1

我正在尝试以我想通过 http 在页面上搜索特定字符串的方式监视 Web 服务器。该命令在 command.cfg 中定义如下

# 'check_http-mysite command definition'
define command {
        command_name check_http-mysite
        command_line /usr/lib/nagios/plugins/check_http -H mysite.example.com -s "Some text" }

# 'notify-host-by-sms' command definition
define command {
        command_name  notify-host-by-sms 
        command_line  /usr/bin/send_sms $CONTACTPAGER$ "Nagios - $NOTIFICATIONTYPE$ :Host$HOSTALIAS$ is $HOSTSTATE$ ($OUTPUT$)"
}
# 'notify-service-by-sms' command definition
define command {
        command_name  notify-service-by-sms 
        command_line  /usr/bin/send_sms $CONTACTPAGER$ "Nagios - $NOTIFICATIONTYPE$: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ ($OUTPUT$)"
}

现在,如果 nagios 在主页 mysite.example.com 上找不到“某些文本”,nagios 应该通过 Clickatell http API 通过短信通知联系人,我有一个脚本,我已经测试过它并发现它工作正常.

每当我更改命令定义以搜索不在页面上的字符串并重新启动 nagios 时,我可以在 Web 界面上看到未找到该字符串。我不明白的是,虽然我已经定义了主机、主机组、联系人、联系人组和服务等,但为什么没有发送通知。我错过了什么,这些是我的定义,在我通过 cgi 进行的 Web 访问中,我可以看到我已经定义并启用了通知,尽管在硬状态更改期间我没有收到电子邮件和短信通知。

主机配置文件

define host {
        use                     generic-host
        host_name               HAL
        alias                   IBM-1
        address                 xxx.xxx.xxx.xxx
        check_command           check_http-mysite     
}

hostgroups_nagios2.cfg

# my website
define hostgroup{
       hostgroup_name  my-servers
       alias           All My Servers
       members         HAL 
}

联系人_nagios2.cfg

define contact {
        contact_name                    colin   
        alias                           Colin Y
        service_notification_period     24x7
        host_notification_period        24x7
        service_notification_options    w,u,c,r,f,s
        host_notification_options       d,u,r,f,s
        service_notification_commands   notify-service-by-email,notify-service-by-sms
        host_notification_commands      notify-host-by-email,notify-host-by-sms
        email                           myaccount@mysite.com
        pager                           +254xxxxxxxxx
}

define contactgroup{
        contactgroup_name   site_admin 
        alias               Site Administrator
        members             colin 
}

services_nagios2.cfg

# check for particular string in page via http 
define service {
        hostgroup_name                  my-servers
        service_description             STRING CHECK
        check_command                   check_http-mysite
        use                             generic-service
        notification_interval           0 ; set > 0 if you want to be renotified
        contacts                        colin
        contact_groups                  site_admin
}

有人可以告诉我哪里出错了。

以下是 generic-host 和 generic-service 定义

generic-service_nagios2.cfg

# generic service template definition
define service{
        name                            generic-service ; The 'name' of this service template
        active_checks_enabled           1       ; Active service checks are enabled
        passive_checks_enabled          1       ; Passive service checks are enabled/accepted
        parallelize_check               1       ; Active service checks should be parallelized (disabling this can lead to major performance problems)
        obsess_over_service             1       ; We should obsess over this service (if necessary)
        check_freshness                 0       ; Default is to NOT check service 'freshness'
        notifications_enabled           1       ; Service notifications are enabled
        event_handler_enabled           1       ; Service event handler is enabled
        flap_detection_enabled          1       ; Flap detection is enabled
        failure_prediction_enabled      1       ; Failure prediction is enabled
        process_perf_data               1       ; Process performance data
        retain_status_information       1       ; Retain status information across program restarts
        retain_nonstatus_information    1       ; Retain non-status information across program restarts
                notification_interval           0               ; Only send notifications on status change by default.
                is_volatile                     0
                check_period                    24x7
                normal_check_interval           5
                retry_check_interval            1
                max_check_attempts              4
                notification_period             24x7
                notification_options            w,u,c,r
                contact_groups                  site_admin
        register                        0       ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL SERVICE, JUST A TEMPLATE!
}

generic-host_nagios2.cfg

define host{
        name                            generic-host    ; The name of this host template
        notifications_enabled           1       ; Host notifications are enabled
        event_handler_enabled           1       ; Host event handler is enabled
        flap_detection_enabled          1       ; Flap detection is enabled
        failure_prediction_enabled      1       ; Failure prediction is enabled
        process_perf_data               1       ; Process performance data
        retain_status_information       1       ; Retain status information across program restarts
        retain_nonstatus_information    1       ; Retain non-status information across program restarts
                max_check_attempts              10
                notification_interval           0
                notification_period             24x7
                notification_options            d,u,r
                contact_groups                  site_admin 
        register                        1       ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE!
}
nagios sms
  • 1 个回答
  • 1795 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve