コード例 #1
0
        if hostname in specialhost:
            username='******'
            password='******'
        else:
            username='******'
            password='******'
        if hostname in ('192.168.5.31','192.168.5.32'):
            self.__cmd='df -Pm' 
 
        self.__host=paramiko.SSHClient()

        self.__host.set_missing_host_key_policy(paramiko.AutoAddPolicy())
        self.__host.connect(hostname=hostname,username=username,password=password,port=port)
        
        
    
    def CheckDisk(self):
        stdin,stdout,stderror=self.__host.exec_command(self.__cmd)
        disks=stdout.readlines()
        
        return disks
        
if __name__=='__main__':
    from stonedogmonitor1.config.initconfig import ConfigObject
    cf=ConfigObject()
    cf.HostName='192.168.17.13'
    machine=XNixHost(cf)
    disks=machine.CheckDisk()
    print(type(disks))       
    for dk in disks:
        print dk 
コード例 #2
0
        dbstate.Status=self._db.CheckStatus()
        dbstate.Version=self._db.CheckVersion()
        dbstate.TSUsage=self._db.CheckTSUsage()
        dbstate.AAS=self._db.CheckAAS()
        
        return dbstate

class OracleASMChecker(OracleRDBMSChecker):
    def __init__(self,cf):
        super(OracleASMChecker,self).__init__(cf)
    
    def Check(self):
        dbstate=super(OracleASMChecker,self).Check()
        dbstate.ASMDG=self._db.CheckASMDG()
        
        return dbstate
    

if __name__=='__main__':
    cf=ConfigObject()
    #cf.ASMTNS='ASM_192.168.1.26'
    cf.HostName='192.168.1.26'
    cf.ServiceName='wxxrdb.center.wxxr.com.cn'
    
    dbc=OracleRDBMSChecker(cf)
    print dbc.Check()      

    print ('-'*30)
    
    asdbc=OracleASMChecker(cf)
    print asdbc.Check()