设为首页 收藏本站
查看: 888|回复: 0

Nagios监控打印机

[复制链接]

尚未签到

发表于 2019-1-12 12:37:56 | 显示全部楼层 |阅读模式
  Nagios以为其良好的状态检测机制,使Nagios可以利用在不同平台上的不同插件实现监控,当然它也支持使用SNMP协议(简单网络管理协议)实现各个平台和设备的监控,所以Nagios也可以使用SNMP协议来监控局域网内的打印机,Nagios监控打印机是使用check_hpjd工具调用SNMP协议来监控打印机的,在安装好的Nagios中的libexec插件目录下可能没有,是因为服务器上没有安装SNMP协议相关的依赖包net-snmp和net-snmp-utils,所以可以直接用yum或者是apt安装下,再重新编译下nagios-plugins,有一点像Nagios没有安装MySQL时没有check_mysql一样,操作如下:

[root@localhost nagios-plugins-2.2.1]# yum -y install net-snmp net-snmp-utils
[root@localhost nagios-plugins-2.2.1]# ./configure --with-nagios-user=nagios --with-nagios-group=nagios
[root@localhost nagios-plugins-2.2.1]# make && make install  此时再看libexec插件目录下就有check_hpjd插件,打印机的监控方式有点类似于Nagios监控Windows上的NSClient++,可以参看http://jim123.blog.运维网.com/4763600/1956790,在Nagios配置好后就有打印的配置模板,同NSClient++中一样修改下模板:
/usr/local/nagios/etc/objects/printer.cfg
define hostgroup{
        hostgroup_name  network-printers
        alias           Network Printers
        }
########################################################################################        
/usr/local/nagios/etc/servers/192.168.1.254.cfg
define host{
        use             generic-printer         ; Inherit default values from a template
        host_name       hplj200                 ; The name we're giving to this printer
        alias           HP LaserJet 200dn       ; A longer name associated with the printer
        address         192.168.1.254           ; IP address of the printer
        hostgroups      network-printers        ; Host groups this printer is associated with
        contact_groups  admins
        }
define service{
        use                     generic-service         ; Inherit values from a template
        host_name               hplj200                 ; The name of the host the service is associated with
        service_description     Printer Status          ; The service description
        check_command           check_hpjd!-C public    ; The command used to monitor the service
        check_interval  10      ; Check the service every 10 minutes under normal conditions
        retry_interval  1       ; Re-check the service every minute until its final/hard state is determined
        max_check_attempts      2
        notifications_enabled   1
        }
define service{
        use                     generic-service
        host_name               hplj200
        service_description     PING
        check_command           check_ping!3000.0,80%!5000.0,100%
        check_interval  10
        retry_interval  1
        max_check_attempts      2
        notifications_enabled   1
        }  当然如果是多台的话,也可以配置成通用模板,然后根据定义好的cfg_dir去配置多个文件:
/usr/local/nagios/etc/objects/printer.cfg
define host{
        name                    network-printers
        check_period            24x7            
        check_interval          5              
        retry_interval          1           
        max_check_attempts      4            
        check_command           check-host-alive      
        notification_period     24x7         
        notification_interval   30              
        notification_options    d,r            
        contact_groups          admins         
        register                0              
        }
define service{
        name                            network-printers               
        max_check_attempts              4                       
        normal_check_interval           3                     
        retry_check_interval            1                       
        register                        0   
        check_period                    24x7  
        process_perf_data               1         
        }  配置好后重启Nagios后就可以实现打印机的监控

  如果是不知道局域网内有多少台打印机,则可以通过nmap扫描一下局域内的9100端口就知道
[root@localhost ~]# nmap -p 515 --open 192.168.1.0/24  





运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-662366-1-1.html 上篇帖子: Centos 6.5 安装-配置Nagios (一) 下篇帖子: Centos 6.5 监控配置Nagios (二)
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表