当前位置: 首页>>代码示例>>Python>>正文


Python Monitor.read方法代码示例

本文整理汇总了Python中monitor.Monitor.read方法的典型用法代码示例。如果您正苦于以下问题:Python Monitor.read方法的具体用法?Python Monitor.read怎么用?Python Monitor.read使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在monitor.Monitor的用法示例。


在下文中一共展示了Monitor.read方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from monitor import Monitor [as 别名]
# 或者: from monitor.Monitor import read [as 别名]
class ScstTest:
    """ Number of helper function to interact with SCST
    
        Often there are two ways to get the data.
        - via a monitor
        - directly via SCST
    """
    
    def __init__(self, hostname="localhost", port=9001):
        self.monitor = Monitor(hostname, port);

    def get_user_in_target(self, target_name):
        """ gets all user in a target.
            The data is gathered over the target monitor
        """
        t = target.read_target_by_name(self.monitor, target_name)
        if not t:
            return None
        return iscsi_scst.get_users_in_target(t)
    
    def get_targets(self):
        """ get a list of all targets.
            The data is gathered directly from SCST
        """
        return iscsi_scst.get_targets()
    
    def get_groups(self):
        """ gets all groups that are registered at SCST
		"""
        return scst.get_scst_groups()
    
    def stop_iscsi(self):
        """ stops the iSCSI daemon
        """
        return iscsi_scst.stop_iscsi()
    
    def get_pid(self):
        """ returns the pid of the daemon
            The data is collected via the status monitor.
            If the daemon is not running, None is returned
        """
        try:
            return int(self.monitor.read("status")["pid"])
        except MonitorException:
            return None
    
    def get_devices_in_group(self, group_name):
        """ returns all devices that are registered at SCST
		for a given group
		"""
        return scst.get_devices_in_group(group_name)
        
开发者ID:FinalF,项目名称:dedupv1,代码行数:53,代码来源:ScstTest.py


注:本文中的monitor.Monitor.read方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。