Exemplo n.º 1
0
def main():
    ip = get_ip_address()
    disklist = f_detect_disk_readonly()

    for disk in disklist:
        # 如果某块磁盘频繁发生只读请联系技术支持!
        message =  "%s %s文件系统只读" % (ip, disk)
        print sendsms(string.join(phone, "|"), message)
Exemplo n.º 2
0
def main():
    ip = get_ip_address()
    disklist = f_detect_disk_readonly()

    for disk in disklist:
        # 如果某块磁盘频繁发生只读请联系技术支持!
        message = "%s %s文件系统只读" % (ip, disk)
        print sendsms(string.join(phone, "|"), message)
Exemplo n.º 3
0
def main():
    ip = get_ip_address()
    diskinfo = f_diskinfo()
    
    # df.1kblocks.total 1373990040 20641404 mount=/ fstype=ext4
    # df.1kblocks.used 1373990040 10632160 mount=/ fstype=ext4
    # df.1kblocks.free 1373990040 8960720 mount=/ fstype=ext4

    for key in diskinfo:

        diskused = float(diskinfo[key].get("df.1kblocks.used"))
        disktotal = float(diskinfo[key].get("df.1kblocks.total"))
        utilization = (diskused / disktotal) 
        if(utilization > watermark ):
            message =  "%s 文件系统 [%s] 磁盘使用率超过 %.2f%%" % (ip, key, utilization * 100)
            print sendsms(string.join(phone, "|"), message)
Exemplo n.º 4
0
def main():
    ip = get_ip_address()
    diskinfo = f_diskinfo()

    # df.1kblocks.total 1373990040 20641404 mount=/ fstype=ext4
    # df.1kblocks.used 1373990040 10632160 mount=/ fstype=ext4
    # df.1kblocks.free 1373990040 8960720 mount=/ fstype=ext4

    for key in diskinfo:

        diskused = float(diskinfo[key].get("df.1kblocks.used"))
        disktotal = float(diskinfo[key].get("df.1kblocks.total"))
        utilization = (diskused / disktotal)
        if (utilization > watermark):
            message = "%s 文件系统 [%s] 磁盘使用率超过 %.2f%%" % (ip, key,
                                                       utilization * 100)
            print sendsms(string.join(phone, "|"), message)
Exemplo n.º 5
0
def main():
    ip = get_ip_address()
    meminfo = f_meminfo()
    
    # proc.meminfo.memfree 1373986088 4005464
    # proc.meminfo.buffers 1373986088 381416
    # proc.meminfo.cached 1373986088 9843132
    # proc.meminfo.memtotal 1373986088 16268732

    memtotal = float(meminfo.get("proc.meminfo.memtotal"));
    memused = memtotal - float(int(meminfo.get('proc.meminfo.memfree')) + int(meminfo.get('proc.meminfo.buffers')) + int(meminfo.get('proc.meminfo.cached')));

    utilization = (memused  / memtotal) 

    if(utilization > watermark ):
        message =  "%s 内存使用率超过 %.2f%%" % (ip, utilization * 100)
        sendsms(string.join(phone, "|") , message)
Exemplo n.º 6
0
def main():
    ip = get_ip_address()
    meminfo = f_meminfo()

    # proc.meminfo.memfree 1373986088 4005464
    # proc.meminfo.buffers 1373986088 381416
    # proc.meminfo.cached 1373986088 9843132
    # proc.meminfo.memtotal 1373986088 16268732

    memtotal = float(meminfo.get("proc.meminfo.memtotal"))
    memused = memtotal - float(
        int(meminfo.get('proc.meminfo.memfree')) +
        int(meminfo.get('proc.meminfo.buffers')) +
        int(meminfo.get('proc.meminfo.cached')))

    utilization = (memused / memtotal)

    if (utilization > watermark):
        message = "%s 内存使用率超过 %.2f%%" % (ip, utilization * 100)
        sendsms(string.join(phone, "|"), message)