<del id="d4fwx"><form id="d4fwx"></form></del>
      <del id="d4fwx"><form id="d4fwx"></form></del><del id="d4fwx"><form id="d4fwx"></form></del>

            <code id="d4fwx"><abbr id="d4fwx"></abbr></code>
          • 自制python腳本監(jiān)控Esxi底層DELL硬盤(利用python自帶模塊paramiko)

            自制python腳本監(jiān)控Esxi底層DELL硬盤(利用python自帶模塊 paramiko)
            [root@localhost libexec]# cd /usr/local/nagios/libexec
            [root@localhost libexec]# vi datadomain.py
            #!/usr/bin/env python
            import paramiko
            import re
            import sys
            #0 ok; 1 warning; 2 critical; 3 unknown
            ssh = paramiko.SSHClient()
            ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
            ip = "10.10.254.11"
            user = "sysadmin"
            passwd = "11111111111111"
            ssh.connect(ip,22,user,passwd)
            stdin,stdout,stderr = ssh.exec_command("disk status")
            outmsg,errmsg = stdout.read(),stderr.read()
            keyvalue=outmsg.find('7')
            if int(keyvalue) <> -1:
            print "Disk ok !"
            sys.exit(0)
            else:
            print "Disk goes wrong!"
            sys.exit(2)
            ssh.close()
            腳本注解:當(dāng)keyvalue等于-1,說明數(shù)量沒有7,也就是硬盤有問題了。

            十余年的方山網(wǎng)站建設(shè)經(jīng)驗(yàn),針對設(shè)計(jì)、前端、開發(fā)、售后、文案、推廣等六對一服務(wù),響應(yīng)快,48小時(shí)及時(shí)工作處理。全網(wǎng)營銷推廣的優(yōu)勢是能夠根據(jù)用戶設(shè)備顯示端的尺寸不同,自動(dòng)調(diào)整方山建站的顯示方式,使網(wǎng)站能夠適用不同顯示終端,在瀏覽器中調(diào)整網(wǎng)站的寬度,無論在任何一種瀏覽器上瀏覽網(wǎng)站,都能展現(xiàn)優(yōu)雅布局與設(shè)計(jì),從而大程度地提升瀏覽體驗(yàn)。成都創(chuàng)新互聯(lián)從事“方山網(wǎng)站設(shè)計(jì)”,“方山網(wǎng)站推廣”以來,每個(gè)客戶項(xiàng)目都認(rèn)真落實(shí)執(zhí)行。

            先在commands.cfg中添加命令。
            [root@localhost libexec]# vi /usr/local/nagios/etc/objects/commands.cfg
            define command {
            command_name datadomain
            command_line sudo $USER1$/datadomain.py
            }

            在nagios.cfg中添加以下內(nèi)容
            [root@localhost libexec]# vi /usr/local/nagios/etc/nagios.cfg

            cfg_file=/usr/local/nagios/etc/objects/datadomain.cfg

            定義主機(jī)和服務(wù):在/usr/local/nagios/etc/objects中新建datadomain.cfg
            [root@localhost libexec]# vi /usr/local/nagios/etc/objects/datadomain.cfg
            define host{
            use EMC DataDomain 2200
            host_name EMC DataDomain 2200
            alias EMC DataDomain 2200
            address 10.10.254.11
            }

            define service{
            use generic-service
            host_name EMC DataDomain 2200
            service_description EMC DataDomain 2200
            check_command datadomain
            notifications_enabled 1
            }

            然后必須在templates.cfg中添加以下內(nèi)容
            [root@localhost libexec]# vi /usr/local/nagios/etc/objects/templates.cfg

            define host{
            name EMC DataDomain 2200 ; The name of this host template
            use generic-host ; This template inherits other values from the generic-host template
            check_period 24x7 ; By default, EMC DataDomain 2200 hosts are checked round the clock
            check_interval 5 ; Actively check the host every 10 minutes
            retry_interval 1 ; Schedule host check retries at 10 minute intervals
            max_check_attempts 10 ; Check each EMC DataDomain 2200 host 10 times (max)
            check_command check-host-alive ; Default command to check EMC DataDomain 2200 hosts
            notification_period workhours ; EMC DataDomain 2200 admins hate to be woken up, so we only notify during the day
            ; Note that the notification_period variable is being overridden from
            ; the value that is inherited from the generic-host template!
            notification_interval 120 ; Resend notifications every 2 hours
            notification_options d,u,r ; Only send notifications for specific host states
            contact_groups admins ; Notifications get sent to the admins by default
            register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE!
            }

            添加sudo權(quán)限
            [root@localhost libexec]# visudo
            nagios ALL=(ALL) NOPASSWD:/usr/local/nagios/libexec/datadomain.py

            分享標(biāo)題:自制python腳本監(jiān)控Esxi底層DELL硬盤(利用python自帶模塊paramiko)
            URL鏈接:http://www.jbt999.com/article32/pdposc.html

            成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供品牌網(wǎng)站設(shè)計(jì)、網(wǎng)站制作、網(wǎng)站策劃、服務(wù)器托管、關(guān)鍵詞優(yōu)化Google

            廣告

            聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:[email protected]。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

            外貿(mào)網(wǎng)站建設(shè)

              <del id="d4fwx"><form id="d4fwx"></form></del>
              <del id="d4fwx"><form id="d4fwx"></form></del><del id="d4fwx"><form id="d4fwx"></form></del>

                    <code id="d4fwx"><abbr id="d4fwx"></abbr></code>
                  • 日韩和亚洲的日本品牌区分米奇777788 | 日韩高清无码本道 | 99久久精品免费看国产交换 | 青青伊人久久 | 国产迷奸久久 |