Menu

please add a command line option that modifies "D", "d", "o" commands to only show physical disks

Help
costinel
2015-01-04
2018-08-02
  • costinel

    costinel - 2015-01-04

    Dear author,

    Please add a command line option or environment variable or toggle key that modifies "D", "d", "o" commands to only show physical disks
    You can get the list of disks in linux from sysfs filesystem, similarly to 'lsblk -d'

    I tried using disk groups but that does not show the same information as "D" command does.

    Also this[1] patch is unuseful since it is permissive (it allows selective exclusion) while I need nmon to be restrictive (to show a list and exclude everything else)

    thanks

    [1] https://sourceforge.net/p/nmon/discussion/985541/thread/b69d6ab4/?limit=25#93d8

     
    • Nigel Griffiths

      Nigel Griffiths - 2015-08-14

      This has been added to nmon for Linux version 15. nmon -g auto
      Let me know what you think.

      This is, of course, trying to work around what I think of as a Linux kernel bug = mixing disks and partition in one /proc/diskstats file.

       
  • tarasl

    tarasl - 2015-03-10

    Dear Authore,
    related to the request https://sourceforge.net/p/nmon/discussion/985541/thread/c711d3ed/#746d

    We are having some problem with the filesystems automonted by autofs
    if mounting requires authentication. When nmon try to open this kind
    of mount points it get authentication errors (that generates system
    malfunctions on the our machines).
    It is possible to exclude the stats on the remote filesystems when nmon
    run in non-interactive mode? Maybe we could modify jfs_load function to
    skip loading of the filesystems belong to a list (hard-coded o by a
    command line parameter passing) FS types.
    If you think this could be a useful feature we can patch the current code.

    Best Regards

     
  • Nigel Griffiths

    Nigel Griffiths - 2015-08-14

    Hi,
    I have not heard of any one using automaount with passwords.
    Can't the root user be used?
    Sorry but given I don't want to set up automount nor use authentication it is a low priority for me.

    I guess this beomes a special patch that you need to apply.
    Cheers, Nigel

     
  • costinel

    costinel - 2015-11-17

    Dear Nigel,

    This is the output when trying to use -g auto. I'm using the precompiled version nmon15e_MPGinc_24_July_2015.tar.gz

    root@home:/usr/local/src# nmon_x86_64_debian7 -g auto
    opening disk group file: No such file or directory
    ERROR: failed to open auto
    

    strace output below. What I don't understand is why are you not surfing the sysfs kernel filesystem tree similar to how lsblk tool does - is it for compatibility with ancient linux systems?
    if yes, look how fdisk is trying to determine if a block device is a physical device in is_whole_disk function http://code.metager.de/source/xref/busybox/util-linux/fdisk.c#is_whole_disk

    stat("/proc/diskstats", {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
    open("/proc/diskstats", O_RDONLY)       = 7
    fstat(7, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
    mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f84dc98f000
    read(7, "   8       0 sda 40291 28092 247"..., 1024) = 1024
    read(7, "0 14900 43088\n   8      49 sdd1 "..., 1024) = 483
    read(7, "", 1024)                       = 0
    lseek(7, 0, SEEK_SET)                   = 0
    mmap(NULL, 135168, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f84dc8ed000
    open("auto", O_RDONLY)                  = -1 ENOENT (No such file or directory)
    dup(2)                                  = 8
    fcntl(8, F_GETFL)                       = 0x8002 (flags O_RDWR|O_LARGEFILE)
    fstat(8, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 2), ...}) = 0
    mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f84dc98e000
    lseek(8, 0, SEEK_CUR)                   = -1 ESPIPE (Illegal seek)
    write(8, "opening disk group file: No such"..., 51opening disk group file: No such file or directory
    ) = 51
    close(8)                                = 0
    munmap(0x7f84dc98e000, 4096)            = 0
    write(2, "ERROR: failed to open auto\n", 27ERROR: failed to open help
    ) = 27
    exit_group(9)                           = ?
    +++ exited with 9 +++
    

    my diskstats look like this:

    root@home:/tmp# cat /proc/diskstats
       8       0 sda 40925 28202 2480706 39916 234007 198380 24206193 2250860 0 329488 2290812
       8       1 sda1 239 401 5092 136 0 0 0 0 0 124 136
       8       2 sda2 394 626 47214 408 373 144 531064 29268 0 2460 29676
       8       3 sda3 39047 22981 2367678 38644 218663 198202 23572904 2220436 0 328084 2259096
       8       4 sda4 21 0 64 12 0 0 0 0 0 12 12
       8       5 sda5 282 1957 33900 276 44 0 3808 20 0 224 296
       8       6 sda6 695 1906 22218 340 14927 34 98417 1136 0 1436 1472
       8      16 sdb 6930033 14242 1530196358 27213512 284137 41 10209136 3569264 2 16574960 30776024
       8      17 sdb1 6929613 10558 1530163652 27211628 284137 41 10209136 3569264 2 16574488 30774144
       8      25 sdb9 187 1686 14956 1332 0 0 0 0 0 1312 1332
       8      32 sdc 6973997 15827 1530367238 26927636 284138 40 10209136 2688068 2 15623896 29609108
       8      33 sdc1 6973577 12143 1530334532 26925932 284138 40 10209136 2688068 2 15623308 29607404
       8      41 sdc9 187 1686 14956 1312 0 0 0 0 0 1288 1312
       8      48 sdd 825 4839 45172 57868 0 0 0 0 0 29668 57868
       8      49 sdd1 657 3825 35772 42884 0 0 0 0 0 15140 42884
       7       0 loop0 0 0 0 0 0 0 0 0 0 0 0
       7       1 loop1 0 0 0 0 0 0 0 0 0 0 0
       7       2 loop2 0 0 0 0 0 0 0 0 0 0 0
       7       3 loop3 0 0 0 0 0 0 0 0 0 0 0
       7       4 loop4 0 0 0 0 0 0 0 0 0 0 0
       7       5 loop5 0 0 0 0 0 0 0 0 0 0 0
       7       6 loop6 0 0 0 0 0 0 0 0 0 0 0
       7       7 loop7 0 0 0 0 0 0 0 0 0 0 0
     230       0 zd0 0 0 0 0 0 0 0 0 0 0 0
     230       1 zd0p1 0 0 0 0 0 0 0 0 0 0 0
    

    It would also be useful to be able to have another option to include/exclude zfs zvol block devices like /dev/zd0 (fdisk finds it as a valid disk, but I'd rather have it excluded from "-g auto" view). For this you simply need to exclude major number 230 of the block device (https://github.com/zfsonlinux/zfs/issues/515#issuecomment-4459005)

     

    Last edit: costinel 2015-11-17
  • Ramoon Lincoln Barros Camacho

    Hello costinel and Mr Nigel, sorry answering too late, but I passed through the same problem today, and that's the way I deal with that.

    I realized that the auto file was being generated in the current directory before moving to my log directory using "-m" option.

    My first solution was entering the directory before executing the nmon command:

    For example:
    cd /opt/ramoon/log;exec /usr/bin/nmon -f -t -s 30 -c 2880 -g auto -D -m /opt/ramoon/log

    After that, I realized that using the "-m" option before the "-g auto -D" was a better approach, and the "cd" wouldn't be necessary:

    exec /usr/bin/nmon -m /opt/ramoon/log -f -t -s 30 -c 2880 -g auto -D

     

Log in to post a comment.