zoukankan      html  css  js  c++  java
  • linux 监控(未完...)

    cpu
    top
    uptime
    dstat

    内存
    free
    vmstat
    dstat

    磁盘
    iostat
    iotop
    df
    dstat

    网络
    ifstat
    dstat

    dstat -c -m -p --io -s -t -d -l --output /home/hxetest/ttt.csv 2

    watch -n 2 nvidia-smi >> /home/hxe/test.log

    网络监控

    psutil python

    import psutil
    
    def get_network():
        recv1=psutil.net_io_counters().bytes_recv/1024
        sent1=psutil.net_io_counters().bytes_sent/1024
        time.sleep(1)
        recv2=psutil.net_io_counters().bytes_recv/1024
        sent2=psutil.net_io_counters().bytes_sent/1024
        recv=recv2-recv1
        sent=sent2-sent1
        res = ['input:'+str(round(recv,2))+' '+'kb/s','output: '+str(round(sent,2))+' '+'kb/s']
        #print(' '.join(res))
    
        return res
    

    GPU监控

    GPUtil python

    import GPUtil
    
    def get_gpu_info():
        '''
        :return:
        '''
        gpulist = []
        Gpus = GPUtil.getGPUs()
        GPUtil.showUtilization()
        
        # 获取多个GPU的信息,存在列表里
        for gpu in Gpus:
            # 按GPU逐个添加信息
            gpulist.append([ 
                '驱动:',gpu.driver,
                'gpu.id:',gpu.id, 
                '显存总量:',gpu.memoryTotal, 
                '显存使用量:', gpu.memoryUsed,
                '显存使用占比:',gpu.memoryUtil * 100,
                'GPU使用占比:', gpu.load * 100,
                'display_mode:',gpu.display_mode,
                'display_active:',gpu.display_active,
                '温度:',gpu。temperature,
            ])
    

    nvidia-smi

    nvidia-smi -l 1 --format=csv --filename=report.csv --query-gpu=timestamp,name,index,utilization.gpu,memory.total,memory.used,power.draw
    --query-gpu用于指定输出的内容
    nvidia-smi --help-query-gpu 查看可用的输出指令

    参考:
    GPU命令详解
    Linux 系统监控命令整理汇总

    上面的内容,主要还是一些知识点整理和个人的一些思考,权当参考,如有错误或者更好的建议,可以在评论区指正,不胜感激!

  • 相关阅读:
    centos 7 -- Disk Requirements: At least 134MB more space needed on the / filesystem.
    DNS Server Centos 7
    生成report由Eamil定時寄出
    WRT 版本说明
    cisco linksys ea3500 刷机 openwrt
    [QNAP crontab 定時執行程式
    实例 编辑 .bashrc(不断更新)
    tar命令
    ls -l 显示年份
    git 丢弃本地代码时遇到的问题
  • 原文地址:https://www.cnblogs.com/Tester_Dolores/p/14893887.html
Copyright © 2011-2022 走看看