zoukankan      html  css  js  c++  java
  • docker iotop :OSError: Netlink error: No such file or directory

    在容器内使用iotop ,错误信息:

    raceback (most recent call last):
      File "/usr/sbin/iotop", line 16, in <module>
        main()
      File "/usr/lib/python2.6/site-packages/iotop/ui.py", line 559, in main
        main_loop()
      File "/usr/lib/python2.6/site-packages/iotop/ui.py", line 549, in <lambda>
        main_loop = lambda: run_iotop(options)
      File "/usr/lib/python2.6/site-packages/iotop/ui.py", line 447, in run_iotop
        return curses.wrapper(run_iotop_window, options)
      File "/usr/lib64/python2.6/curses/wrapper.py", line 43, in wrapper
        return func(stdscr, *args, **kwds)
      File "/usr/lib/python2.6/site-packages/iotop/ui.py", line 437, in run_iotop_window
        taskstats_connection = TaskStatsNetlink(options)
      File "/usr/lib/python2.6/site-packages/iotop/data.py", line 113, in __init__
        self.family_id = controller.get_family_id('TASKSTATS')
      File "/usr/lib/python2.6/site-packages/iotop/genetlink.py", line 54, in get_family_id
        m = self.conn.recv()
      File "/usr/lib/python2.6/site-packages/iotop/netlink.py", line 190, in recv
        raise err
    OSError: Netlink error: No such file or directory (2)

    iotop是通过内核的taskstats接口获取统计信息的。taskstats是基于generic netlink实现的,而且taskstats不支持net namespace。

    static struct genl_family family = {
    	.id		= GENL_ID_GENERATE,
    	.name		= TASKSTATS_GENL_NAME,
    	.version	= TASKSTATS_GENL_VERSION,
    	.maxattr	= TASKSTATS_CMD_ATTR_MAX,
    };
    
    
    static int ctrl_dumpfamily(struct sk_buff *skb, struct netlink_callback *cb)
    {
     int i, n = 0;
     struct genl_family *rt;
     struct net *net = sock_net(skb->sk);
     int chains_to_skip = cb->args[0];
     int fams_to_skip = cb->args[1];
     for (i = chains_to_skip; i < GENL_FAM_TAB_SIZE; i++) {
      n = 0;
      list_for_each_entry(rt, genl_family_chain(i), family_list) {
       if (!rt->netnsok && !net_eq(net, &init_net))///don't support netnamespace
        continue;


  • 相关阅读:
    java enum
    how to build a runable jar
    ZF报错解决方法·
    Apache配置本地测试多网站域名与虚拟主机
    PHP实现MVC开发: 一个简单的MVC
    收藏PHP常用函数
    数据库密码忘记…………找回方法
    php读取excel文件reader.php excel操作类使用
    积累的常用linux命令
    JS控制浏览器大小
  • 原文地址:https://www.cnblogs.com/wuyida/p/6300865.html
Copyright © 2011-2022 走看看