Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Solaris / SmartOs #10

Closed
krzaczek opened this issue Aug 3, 2016 · 46 comments
Closed

Support Solaris / SmartOs #10

krzaczek opened this issue Aug 3, 2016 · 46 comments
Milestone

Comments

@krzaczek
Copy link

krzaczek commented Aug 3, 2016

Hi,

I'm having problems installing vmstat on SmartOs. This fails during gitlab upgrade.

[root@gitlab /home/git/gitlab]# uname -a
SunOS gitlab 5.11 joyent_20151015T063628Z i86pc i386 i86pc Solaris
[root@gitlab /home/git/gitlab]# sudo -u git -H gem install vmstat -v 2.1.1
Building native extensions.  This could take a while...
ERROR:  Error installing vmstat:
        ERROR: Failed to build gem native extension.

    /opt/local/bin/ruby215 extconf.rb
checking for unistd.h... yes
checking for getpagesize()... yes
checking for stdlib.h... yes
checking for getloadavg()... yes
checking for mach/mach.h... no
checking for mach/mach_host.h... no
checking for host_processor_info()... no
checking for mach_host_self()... no
checking for mach_task_self()... no
checking for vm_deallocate()... no
checking for mach_error_string()... no
checking for task_info()... no
checking for KERN_SUCCESS in mach/mach.h,mach/mach_host.h... no
checking for TASK_BASIC_INFO in mach/mach.h,mach/mach_host.h... no
checking for HOST_VM_INFO in mach/mach.h,mach/mach_host.h... no
checking for CPU_STATE_MAX in mach/mach.h,mach/mach_host.h... no
checking for PROCESSOR_CPU_LOAD_INFO in mach/mach.h,mach/mach_host.h... no
checking for CPU_STATE_USER in mach/mach.h,mach/mach_host.h... no
checking for CPU_STATE_SYSTEM in mach/mach.h,mach/mach_host.h... no
checking for CPU_STATE_NICE in mach/mach.h,mach/mach_host.h... no
checking for CPU_STATE_IDLE in mach/mach.h,mach/mach_host.h... no
checking for sys/param.h... yes
checking for sys/mount.h... yes
checking for sys/statfs.h... yes
checking for statfs()... yes
checking for unistd.h... yes
checking for sys/sysctl.h... no
checking for sys/types.h... yes
checking for sys/socket.h... yes
checking for net/if.h... yes
checking for net/if_mib.h... no
checking for net/if_types.h... yes
checking for getloadavg()... yes
checking for sysctl()... no
checking for struct ifmibdata in unistd.h,sys/sysctl.h,sys/types.h,sys/socket.h,net/if.h,net/if_mib.h,net/if_types.h... no
checking for CTL_NET in unistd.h,sys/sysctl.h,sys/types.h,sys/socket.h,net/if.h,net/if_mib.h,net/if_types.h... no
checking for PF_LINK in unistd.h,sys/sysctl.h,sys/types.h,sys/socket.h,net/if.h,net/if_mib.h,net/if_types.h... no
checking for NETLINK_GENERIC in unistd.h,sys/sysctl.h,sys/types.h,sys/socket.h,net/if.h,net/if_mib.h,net/if_types.h... no
checking for IFMIB_IFDATA in unistd.h,sys/sysctl.h,sys/types.h,sys/socket.h,net/if.h,net/if_mib.h,net/if_types.h... no
checking for IFDATA_GENERAL in unistd.h,sys/sysctl.h,sys/types.h,sys/socket.h,net/if.h,net/if_mib.h,net/if_types.h... no
checking for CTL_KERN in unistd.h,sys/sysctl.h,sys/types.h,sys/socket.h,net/if.h,net/if_mib.h,net/if_types.h... no
checking for KERN_BOOTTIME in unistd.h,sys/sysctl.h,sys/types.h,sys/socket.h,net/if.h,net/if_mib.h,net/if_types.h... no
creating extconf.h
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling vmstat.c
In file included from vmstat.c:3:0:
./hw/statfs.h: In function 'vmstat_disk':
./hw/statfs.h:17:7: error: too few arguments to function 'statfs'
   if (statfs(StringValueCStr(path), &stat) != -1) {
       ^
In file included from ./hw/statfs.h:8:0,
                 from vmstat.c:3:
/usr/include/sys/statfs.h:75:5: note: declared here
 int statfs(const char *, struct statfs *, int, int);
     ^
In file included from /opt/local/include/ruby-2.1.5/ruby.h:33:0,
                 from ./vmstat.h:1,
                 from vmstat.c:1:
./hw/statfs.h:20:45: error: 'struct statfs' has no member named 'f_type'
            rb_intern("new"), 6, ULL2NUM(stat.f_type),
                                             ^
/opt/local/include/ruby-2.1.5/ruby/ruby.h:245:32: note: in definition of macro 'ULL2NUM'
 #define ULL2NUM(v) rb_ull2inum(v)
                                ^
./hw/statfs.h:24:45: error: 'struct statfs' has no member named 'f_bavail'
                                 ULL2NUM(stat.f_bavail),
                                             ^
/opt/local/include/ruby-2.1.5/ruby/ruby.h:245:32: note: in definition of macro 'ULL2NUM'
 #define ULL2NUM(v) rb_ull2inum(v)
                                ^
Makefile:224: recipe for target 'vmstat.o' failed
make: *** [vmstat.o] Error 1

make failed, exit code 2
@threez
Copy link
Owner

threez commented Aug 4, 2016

do you have a proc filesystem in solaris?

@krzaczek
Copy link
Author

krzaczek commented Aug 4, 2016

@threez
Copy link
Owner

threez commented Aug 4, 2016

It seems that the solaris procfs doesn't contain the required information. Looking at NetBSD's top implementation, it seems a new kernel api (kstat.h) needs to be implemented for that.

@threez
Copy link
Owner

threez commented Aug 4, 2016

Could you make a gist or comment that contains the output of top -l 1 -n 0 > probe.txt or probabls it's top -n 0 > probe.txt?

@krzaczek
Copy link
Author

krzaczek commented Aug 5, 2016

There is no top command in solaris.

@threez
Copy link
Owner

threez commented Aug 5, 2016

what do you use then?

@krzaczek
Copy link
Author

krzaczek commented Aug 5, 2016

prstat is something similar to top

@threez
Copy link
Owner

threez commented Aug 5, 2016

could you provide the output of mpstat 1 1 and vmstat 1 1 as a comment?

@krzaczek
Copy link
Author

krzaczek commented Aug 5, 2016

[root@gitlab ~]# mpstat 1 1
CPU minf mjf xcal  intr ithr  csw icsw migr smtx  srw syscl  usr sys  wt idl
  0 1491   0   14   515  150 2308    2   56  630    0 12926    3   4   0  94
  1 1420   0    8    92   39 2737    1   25  713    0 11246    3   3   0  94
  2  394   0   10    91   32 1076    1   32  432    0  2848    2   2   0  96
  3  469   0    6   400  143 1359    1   24  454    0  3728    2   2   0  96
  4  116   0    5    73   28  613    1   22  228    0  1629    1   1   0  98
  5  133   0    6   150   70  689    1   20  194    0  2298    1   1   0  98
  6   83   0    5   182   58  472    1   22  127    0  1638    1   1   0  98
  7   85   0    5   247  116  704    1   23  109    0  2375    1   1   0  98
  8  111   0    3    70   29  408    1   18  115    0  1745    1   1   0  99
  9  100   0    3   319  248  528    1   20  104    0  1984    1   1   0  98
 10   92   0    4   336  238  461    1   27  111    0  1726    1   1   0  98
 11   78   0    4   241  114  674    1   22   96    0  2268    1   1   0  98
 12  111   0   20   191   85  413    1   20  111    0  1586    1   1   0  99
 13   96   0    3   124   57  499    0   20  102    0  1897    1   1   0  99
 14   94   0    4    94   39  437    1   21  111    0  1581    1   1   0  98
 15   75   0    4   237  112  660    1   22   96    0  2183    1   1   0  98
 16  112   0    2    58   24  419    1   19  118    0  1719    1   1   0  98
 17   95   0    3   414  333  587    1   28  104    0  2035    1   1   0  98
 18   83   0    2    44   17  308    1   17  101    0  1068    1   1   0  99
 19   82   0    5   103   47  416    0   19   95    0  1558    1   1   0  99
 20   49   0    3    76   32  345    1   19   85    0  1138    1   1   0  98
 21   55   0    9   258  122  621    1   22   85    0  2040    1   1   0  98
 22   87   0    2    51   21  348    1   17   99    0  1211    1   1   0  99
 23   87   0    3   110   50  476    1   20   96    0  1749    1   1   0  99
 24   74   0    4    83   35  403    1   19  105    0  1397    1   1   0  98
 25   70   0    4   230  109  655    1   23   96    0  2128    1   1   0  98
 26  102   0    2    51   21  377    1   17  111    0  1487    1   1   0  99
 27   92   0    3   115   53  496    0   20  104    0  1837    1   1   0  99
 28   89   0    3   170   52  432    1   21  119    0  1562    1   1   0  98
 29   74   0    4   237  111  683    1   23  108    0  2207    1   1   0  98
 30  113   0    2    53   21  414    1   19  128    0  1728    1   1   0  99
 31   97   0    4   125   58  550    1   22  126    0  1941    1   1   0  99
[root@gitlab ~]# vmstat 1 1
 kthr      memory            page            disk          faults      cpu
 r b w   swap  free  re  mf pi po fr de sr rm s0 s1 s2   in   sy   cs us sy id
 0 0 36 78644532 23149256 1181 6309 0 0 0 0 12 -20715 -5 148 108 5541 80462 21566 1 1 98

@threez threez added this to the v2.2.0 milestone Aug 7, 2016
threez pushed a commit that referenced this issue Aug 7, 2016
threez pushed a commit that referenced this issue Aug 7, 2016
(based on shellout - but no boot time or disks)
@threez
Copy link
Owner

threez commented Aug 7, 2016

I created a new pre release gem, https://github.com/threez/ruby-vmstat/releases/tag/v2.2.0-0
could you test if it works for you?

@krzaczek
Copy link
Author

krzaczek commented Aug 8, 2016

@threez will try it today and let You know

@krzaczek
Copy link
Author

krzaczek commented Aug 8, 2016

Looks like it works

[root@gitlab /tmp]# gem install vmstat-2.2.0.pre.0.gem 
Building native extensions.  This could take a while...
Successfully installed vmstat-2.2.0.pre.0
Parsing documentation for vmstat-2.2.0.pre.0
Installing ri documentation for vmstat-2.2.0.pre.0
Done installing documentation for vmstat after 0 seconds
1 gem installed

@threez
Copy link
Owner

threez commented Aug 8, 2016

Looks good, I enhanced the solaris metrics again and created a second pre release. Could you install that too and post the result of the ruby command below? That way I can verify if everything works as expected. If there are any errors, please post them too. If you have any privacy trouble posting the results here, make a private gist and send the link using github to me. Thx

ruby -rvmstat -rpp -e "pp Vmstat.snapshot(['/'])"

@krzaczek
Copy link
Author

krzaczek commented Aug 8, 2016

[root@gitlab /tmp]# ruby -rvmstat -rpp -e "pp Vmstat.snapshot(['/'])"
/opt/local/lib/ruby/2.1.5/rubygems/core_ext/kernel_require.rb:55:in `require': /opt/local/lib/ruby/gems/2.1.5/gems/vmstat-2.2.0.pre.1/lib/vmstat/solaris.rb:9: syntax error, unexpected ']', expecting ')' (SyntaxError)
/opt/local/lib/ruby/gems/2.1.5/gems/vmstat-2.2.0.pre.1/lib/vmstat/solaris.rb:69: syntax error, unexpected end-of-input, expecting keyword_end
        from /opt/local/lib/ruby/2.1.5/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /opt/local/lib/ruby/gems/2.1.5/gems/vmstat-2.2.0.pre.1/lib/vmstat.rb:106:in `<top (required)>'
        from /opt/local/lib/ruby/2.1.5/rubygems/core_ext/kernel_require.rb:135:in `require'
        from /opt/local/lib/ruby/2.1.5/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
        from /opt/local/lib/ruby/2.1.5/rubygems/core_ext/kernel_require.rb:144:in `require'

@krzaczek
Copy link
Author

krzaczek commented Aug 8, 2016

@threez looks like a ] at the end of line instead )

Cpu.new(num.to_i, user.to_i, sys.to_i, 0, idle.to_i]

@threez
Copy link
Owner

threez commented Aug 9, 2016

Right, wrong ] if you replaced it with ) would it then work?

@krzaczek
Copy link
Author

krzaczek commented Aug 9, 2016

nope :(

[root@gitlab ~]# ruby -rvmstat -rpp -e "pp Vmstat.snapshot(['/'])"
/opt/local/lib/ruby/gems/2.1.5/gems/vmstat-2.2.0.pre.1/lib/vmstat/snapshot.rb:26:in `block in initialize': undefined method `disk' for Vmstat:Module (NoMethodError)
        from /opt/local/lib/ruby/gems/2.1.5/gems/vmstat-2.2.0.pre.1/lib/vmstat/snapshot.rb:26:in `map'
        from /opt/local/lib/ruby/gems/2.1.5/gems/vmstat-2.2.0.pre.1/lib/vmstat/snapshot.rb:26:in `initialize'
        from /opt/local/lib/ruby/gems/2.1.5/gems/vmstat-2.2.0.pre.1/lib/vmstat.rb:81:in `new'
        from /opt/local/lib/ruby/gems/2.1.5/gems/vmstat-2.2.0.pre.1/lib/vmstat.rb:81:in `snapshot'
        from -e:1:in `<main>'

@threez
Copy link
Owner

threez commented Aug 9, 2016

hmm, seems like there is still a problem with statvfs. man 2 statvfs works for you right?

@threez
Copy link
Owner

threez commented Aug 9, 2016

please also try ruby -rvmstat -rpp -e "pp Vmstat.snapshot", that avoids calling statsvfs

@krzaczek
Copy link
Author

krzaczek commented Aug 9, 2016

@threez same error

/opt/local/lib/ruby/gems/2.1.5/gems/vmstat-2.2.0.pre.1/lib/vmstat/snapshot.rb:26:inblock in initialize': undefined method disk' for Vmstat:Module (NoMethodError)

@krzaczek
Copy link
Author

krzaczek commented Aug 9, 2016

Yes man 2 statvfs works ok - loads man file

threez pushed a commit that referenced this issue Aug 9, 2016
threez pushed a commit that referenced this issue Aug 9, 2016
@threez
Copy link
Owner

threez commented Aug 9, 2016

okay a created another pre release, https://github.com/threez/ruby-vmstat/releases/download/v2.2.0-2/vmstat-2.2.0.pre.2.gem, please check again with

ruby -rvmstat -rpp -e "pp Vmstat.snapshot(['/'])"

@krzaczek
Copy link
Author

krzaczek commented Aug 9, 2016

same

/opt/local/lib/ruby/gems/2.1.5/gems/vmstat-2.2.0.pre.2/lib/vmstat/snapshot.rb:26:in `block in initialize': undefined method `disk' for Vmstat:Module (NoMethodError)
        from /opt/local/lib/ruby/gems/2.1.5/gems/vmstat-2.2.0.pre.2/lib/vmstat/snapshot.rb:26:in `map'
        from /opt/local/lib/ruby/gems/2.1.5/gems/vmstat-2.2.0.pre.2/lib/vmstat/snapshot.rb:26:in `initialize'
        from /opt/local/lib/ruby/gems/2.1.5/gems/vmstat-2.2.0.pre.2/lib/vmstat.rb:81:in `new'
        from /opt/local/lib/ruby/gems/2.1.5/gems/vmstat-2.2.0.pre.2/lib/vmstat.rb:81:in `snapshot'
        from -e:1:in `<main>'

@krzaczek
Copy link
Author

krzaczek commented Aug 9, 2016

[root@gitlab /tmp]# cc -o test test.c && ./test
/ zfs 131072 187168110 187168110 240161991

threez pushed a commit that referenced this issue Aug 9, 2016
@threez
Copy link
Owner

threez commented Aug 9, 2016

that looks good, hope my change will detect statvfs correctly. I created another pre release: https://github.com/threez/ruby-vmstat/releases/download/v2.2.0-3/vmstat-2.2.0.pre.3.gem. Please test

@krzaczek
Copy link
Author

krzaczek commented Aug 9, 2016

[root@gitlab /tmp]# ruby -rvmstat -rpp -e "pp Vmstat.snapshot(['/'])"
mdb: failed to open /dev/ksyms: No such file or directory
/opt/local/lib/ruby/gems/2.1.5/gems/vmstat-2.2.0.pre.3/lib/vmstat/solaris.rb:67:in `block in extract_solaris_mval': undefined method `grep' for "":String (NoMethodError)
        from /opt/local/lib/ruby/gems/2.1.5/gems/vmstat-2.2.0.pre.3/lib/vmstat/solaris.rb:65:in `each'
        from /opt/local/lib/ruby/gems/2.1.5/gems/vmstat-2.2.0.pre.3/lib/vmstat/solaris.rb:65:in `extract_solaris_mval'
        from /opt/local/lib/ruby/gems/2.1.5/gems/vmstat-2.2.0.pre.3/lib/vmstat/solaris.rb:33:in `memory'
        from /opt/local/lib/ruby/gems/2.1.5/gems/vmstat-2.2.0.pre.3/lib/vmstat/snapshot.rb:28:in `initialize'
        from /opt/local/lib/ruby/gems/2.1.5/gems/vmstat-2.2.0.pre.3/lib/vmstat.rb:81:in `new'
        from /opt/local/lib/ruby/gems/2.1.5/gems/vmstat-2.2.0.pre.3/lib/vmstat.rb:81:in `snapshot'
        from -e:1:in `<main>'

@krzaczek krzaczek closed this as completed Aug 9, 2016
@krzaczek krzaczek reopened this Aug 9, 2016
@threez
Copy link
Owner

threez commented Aug 9, 2016

Okay disk seems to work now. Memory still has a problem. Could you issue echo ::memstat | mdb -k as a user, might be available only as root?

@krzaczek
Copy link
Author

krzaczek commented Aug 9, 2016

hmm ok this works on host server

[root@smartos2 ~]# echo ::memstat | mdb -k
Page Summary                Pages                MB  %Tot
------------     ----------------  ----------------  ----
Kernel                    2115096              8262   17%
ZFS File Data              752887              2940    6%
Anon                      4229677             16522   34%
Exec and libs               11331                44    0%
Page cache                  58501               228    0%
Free (cachelist)           341849              1335    3%
Free (freelist)           5059444             19763   40%

Total                    12568785             49096
Physical                 12568783             49096

but not inside a zone ( solaris vm )

[root@gitlab ~]# echo ::memstat | mdb -k
mdb: failed to open /dev/ksyms: No such file or directory

@threez
Copy link
Owner

threez commented Aug 9, 2016

is there another way to get the memory statistics, that you know of?

@krzaczek
Copy link
Author

krzaczek commented Aug 9, 2016

[root@gitlab ~]# kstat -T d -p :::physmem :::pp_kernel zfs:::size :::pagesfree 1 1
Tue Aug  9 16:33:00 CEST 2016
unix:0:system_pages:physmem 12568785
unix:0:system_pages:pp_kernel   2869876
zfs:0:arcstats:size 3438894600
unix:0:system_pages:pagesfree   5338394

@krzaczek
Copy link
Author

krzaczek commented Aug 9, 2016

or

[root@gitlab ~]# lgrpinfo
lgroup 0 (root):
    Children: 1 2
    CPUs: 0-31
    Memory: installed 48G, allocated 28G, free 20G
    Lgroup resources: 1 2 (CPU); 1 2 (memory)
    Latency: 91991
lgroup 1 (leaf):
    Children: none, Parent: 0
    CPUs: 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30
    Memory: installed 32G, allocated 14G, free 18G
    Lgroup resources: 1 (CPU); 1 (memory)
    Load: 0.0798
    Latency: 64512
lgroup 2 (leaf):
    Children: none, Parent: 0
    CPUs: 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31
    Memory: installed 16G, allocated 14G, free 2.1G
    Lgroup resources: 2 (CPU); 2 (memory)
    Load: 0.108
    Latency: 64512

@krzaczek
Copy link
Author

krzaczek commented Aug 9, 2016

Basicly kstat is always available and should return all information about the current system status

@threez
Copy link
Owner

threez commented Aug 9, 2016

Thx, that is very helpful, need to digest that stuff. I try to come up with something until tomorrow.

@threez
Copy link
Owner

threez commented Aug 9, 2016

Does dlstat -u Rwork inside the zone or is that also only available on the host?

@krzaczek
Copy link
Author

krzaczek commented Aug 9, 2016

Nope - empty result inside a zone

@threez
Copy link
Owner

threez commented Aug 9, 2016

Okay created yet another pre release, all queries against the system status are done using kstat, https://github.com/threez/ruby-vmstat/releases/download/v2.2.0-4/vmstat-2.2.0.pre.4.gem, please test.

@krzaczek
Copy link
Author

nope

[root@gitlab /tmp]# ruby -rvmstat -rpp -e "pp Vmstat.snapshot(['/'])"
/opt/local/lib/ruby/gems/2.1.5/gems/vmstat-2.2.0.pre.4/lib/vmstat/solaris.rb:8:in `block in cpu': undefined local variable or method `values' for Vmstat:Module (NameError)
        from /opt/local/lib/ruby/gems/2.1.5/gems/vmstat-2.2.0.pre.4/lib/vmstat/solaris.rb:6:in `each'
        from /opt/local/lib/ruby/gems/2.1.5/gems/vmstat-2.2.0.pre.4/lib/vmstat/solaris.rb:6:in `cpu'
        from /opt/local/lib/ruby/gems/2.1.5/gems/vmstat-2.2.0.pre.4/lib/vmstat/snapshot.rb:25:in `initialize'
        from /opt/local/lib/ruby/gems/2.1.5/gems/vmstat-2.2.0.pre.4/lib/vmstat.rb:81:in `new'
        from /opt/local/lib/ruby/gems/2.1.5/gems/vmstat-2.2.0.pre.4/lib/vmstat.rb:81:in `snapshot'
        from -e:1:in `<main>'

@krzaczek
Copy link
Author

[root@gitlab /tmp]# kstat -p "cpu_stat:::/idle|kernel|user/"
cpu_stat:0:cpu_stat0:idle       2325343762
cpu_stat:0:cpu_stat0:idlethread 776439232
cpu_stat:0:cpu_stat0:kernel     89137335
cpu_stat:0:cpu_stat0:kernel_asflt       1
cpu_stat:0:cpu_stat0:user       64919001
cpu_stat:1:cpu_stat1:idle       2322767706
cpu_stat:1:cpu_stat1:idlethread 125993797
cpu_stat:1:cpu_stat1:kernel     78457429
cpu_stat:1:cpu_stat1:kernel_asflt       34
cpu_stat:1:cpu_stat1:user       78174710
cpu_stat:2:cpu_stat2:idle       2390178542
cpu_stat:2:cpu_stat2:idlethread 3368087417
cpu_stat:2:cpu_stat2:kernel     50617796
cpu_stat:2:cpu_stat2:kernel_asflt       0
cpu_stat:2:cpu_stat2:user       38603497
cpu_stat:3:cpu_stat3:idle       2390802861
cpu_stat:3:cpu_stat3:idlethread 1772145290
cpu_stat:3:cpu_stat3:kernel     46044221
cpu_stat:3:cpu_stat3:kernel_asflt       0
cpu_stat:3:cpu_stat3:user       42552751
cpu_stat:4:cpu_stat4:idle       2436590263
cpu_stat:4:cpu_stat4:idlethread 2145015281
cpu_stat:4:cpu_stat4:kernel     23983506
cpu_stat:4:cpu_stat4:kernel_asflt       0
cpu_stat:4:cpu_stat4:user       18826062
cpu_stat:5:cpu_stat5:idle       2435969240
cpu_stat:5:cpu_stat5:idlethread 3720145695
cpu_stat:5:cpu_stat5:kernel     25630307
cpu_stat:5:cpu_stat5:kernel_asflt       0
cpu_stat:5:cpu_stat5:user       17800281
cpu_stat:6:cpu_stat6:idle       2432659504
cpu_stat:6:cpu_stat6:idlethread 3012624014
cpu_stat:6:cpu_stat6:kernel     24414413
cpu_stat:6:cpu_stat6:kernel_asflt       0
cpu_stat:6:cpu_stat6:user       22325909
cpu_stat:7:cpu_stat7:idle       2430409364
cpu_stat:7:cpu_stat7:idlethread 1931519381
cpu_stat:7:cpu_stat7:kernel     28094309
cpu_stat:7:cpu_stat7:kernel_asflt       0
cpu_stat:7:cpu_stat7:user       20896150
cpu_stat:8:cpu_stat8:idle       2443187236
cpu_stat:8:cpu_stat8:idlethread 1900014542
cpu_stat:8:cpu_stat8:kernel     20799721
cpu_stat:8:cpu_stat8:kernel_asflt       0
cpu_stat:8:cpu_stat8:user       15412864
cpu_stat:9:cpu_stat9:idle       2440596009
cpu_stat:9:cpu_stat9:idlethread 3703869451
cpu_stat:9:cpu_stat9:kernel     23787482
cpu_stat:9:cpu_stat9:kernel_asflt       0
cpu_stat:9:cpu_stat9:user       15016328
cpu_stat:10:cpu_stat10:idle     2427567910
cpu_stat:10:cpu_stat10:idlethread       3191481058
cpu_stat:10:cpu_stat10:kernel   30059932
cpu_stat:10:cpu_stat10:kernel_asflt     5
cpu_stat:10:cpu_stat10:user     21771975
cpu_stat:11:cpu_stat11:idle     2431827979
cpu_stat:11:cpu_stat11:idlethread       1824361353
cpu_stat:11:cpu_stat11:kernel   27388335
cpu_stat:11:cpu_stat11:kernel_asflt     0
cpu_stat:11:cpu_stat11:user     20183500
cpu_stat:12:cpu_stat12:idle     2442824569
cpu_stat:12:cpu_stat12:idlethread       2037054756
cpu_stat:12:cpu_stat12:kernel   21276397
cpu_stat:12:cpu_stat12:kernel_asflt     0
cpu_stat:12:cpu_stat12:user     15298846
cpu_stat:13:cpu_stat13:idle     2443388458
cpu_stat:13:cpu_stat13:idlethread       3442886390
cpu_stat:13:cpu_stat13:kernel   22081759
cpu_stat:13:cpu_stat13:kernel_asflt     0
cpu_stat:13:cpu_stat13:user     13929592
cpu_stat:14:cpu_stat14:idle     2434768696
cpu_stat:14:cpu_stat14:idlethread       2856867656
cpu_stat:14:cpu_stat14:kernel   23352419
cpu_stat:14:cpu_stat14:kernel_asflt     0
cpu_stat:14:cpu_stat14:user     21278693
cpu_stat:15:cpu_stat15:idle     2432514522
cpu_stat:15:cpu_stat15:idlethread       1703823954
cpu_stat:15:cpu_stat15:kernel   27050642
cpu_stat:15:cpu_stat15:kernel_asflt     16
cpu_stat:15:cpu_stat15:user     19834642
cpu_stat:16:cpu_stat16:idle     2436582325
cpu_stat:16:cpu_stat16:idlethread       1983802071
cpu_stat:16:cpu_stat16:kernel   21833225
cpu_stat:16:cpu_stat16:kernel_asflt     0
cpu_stat:16:cpu_stat16:user     20984253
cpu_stat:17:cpu_stat17:idle     2432250902
cpu_stat:17:cpu_stat17:idlethread       307297399
cpu_stat:17:cpu_stat17:kernel   29580663
cpu_stat:17:cpu_stat17:kernel_asflt     0
cpu_stat:17:cpu_stat17:user     17568236
cpu_stat:18:cpu_stat18:idle     2447310538
cpu_stat:18:cpu_stat18:idlethread       1473510287
cpu_stat:18:cpu_stat18:kernel   18480841
cpu_stat:18:cpu_stat18:kernel_asflt     5
cpu_stat:18:cpu_stat18:user     13608419
cpu_stat:19:cpu_stat19:idle     2446462748
cpu_stat:19:cpu_stat19:idlethread       2882237650
cpu_stat:19:cpu_stat19:kernel   20384068
cpu_stat:19:cpu_stat19:kernel_asflt     0
cpu_stat:19:cpu_stat19:user     12552980
cpu_stat:20:cpu_stat20:idle     2439710143
cpu_stat:20:cpu_stat20:idlethread       2513415319
cpu_stat:20:cpu_stat20:kernel   20976077
cpu_stat:20:cpu_stat20:kernel_asflt     0
cpu_stat:20:cpu_stat20:user     18713575
cpu_stat:21:cpu_stat21:idle     2434565830
cpu_stat:21:cpu_stat21:idlethread       1574993351
cpu_stat:21:cpu_stat21:kernel   26063716
cpu_stat:21:cpu_stat21:kernel_asflt     0
cpu_stat:21:cpu_stat21:user     18770245
cpu_stat:22:cpu_stat22:idle     2447896586
cpu_stat:22:cpu_stat22:idlethread       1566290884
cpu_stat:22:cpu_stat22:kernel   18718466
cpu_stat:22:cpu_stat22:kernel_asflt     0
cpu_stat:22:cpu_stat22:user     12784738
cpu_stat:23:cpu_stat23:idle     2444823222
cpu_stat:23:cpu_stat23:idlethread       3286395080
cpu_stat:23:cpu_stat23:kernel   21510594
cpu_stat:23:cpu_stat23:kernel_asflt     0
cpu_stat:23:cpu_stat23:user     13065972
cpu_stat:24:cpu_stat24:idle     2437316848
cpu_stat:24:cpu_stat24:idlethread       2628739060
cpu_stat:24:cpu_stat24:kernel   22266295
cpu_stat:24:cpu_stat24:kernel_asflt     0
cpu_stat:24:cpu_stat24:user     19816643
cpu_stat:25:cpu_stat25:idle     2433451000
cpu_stat:25:cpu_stat25:idlethread       1604646150
cpu_stat:25:cpu_stat25:kernel   26748441
cpu_stat:25:cpu_stat25:kernel_asflt     0
cpu_stat:25:cpu_stat25:user     19200341
cpu_stat:26:cpu_stat26:idle     2446405472
cpu_stat:26:cpu_stat26:idlethread       1573139378
cpu_stat:26:cpu_stat26:kernel   19619834
cpu_stat:26:cpu_stat26:kernel_asflt     0
cpu_stat:26:cpu_stat26:user     13374474
cpu_stat:27:cpu_stat27:idle     2444019515
cpu_stat:27:cpu_stat27:idlethread       3275705315
cpu_stat:27:cpu_stat27:kernel   21816225
cpu_stat:27:cpu_stat27:kernel_asflt     0
cpu_stat:27:cpu_stat27:user     13564039
cpu_stat:28:cpu_stat28:idle     2435784523
cpu_stat:28:cpu_stat28:idlethread       2628201319
cpu_stat:28:cpu_stat28:kernel   23125551
cpu_stat:28:cpu_stat28:kernel_asflt     0
cpu_stat:28:cpu_stat28:user     20489701
cpu_stat:29:cpu_stat29:idle     2432230501
cpu_stat:29:cpu_stat29:idlethread       1635408506
cpu_stat:29:cpu_stat29:kernel   27198273
cpu_stat:29:cpu_stat29:kernel_asflt     0
cpu_stat:29:cpu_stat29:user     19970999
cpu_stat:30:cpu_stat30:idle     2444413183
cpu_stat:30:cpu_stat30:idlethread       1644573224
cpu_stat:30:cpu_stat30:kernel   20310412
cpu_stat:30:cpu_stat30:kernel_asflt     0
cpu_stat:30:cpu_stat30:user     14676176
cpu_stat:31:cpu_stat31:idle     2442483106
cpu_stat:31:cpu_stat31:idlethread       3345414215
cpu_stat:31:cpu_stat31:kernel   22515695
cpu_stat:31:cpu_stat31:kernel_asflt     0
cpu_stat:31:cpu_stat31:user     14400967

threez pushed a commit that referenced this issue Aug 10, 2016
@threez
Copy link
Owner

threez commented Aug 10, 2016

Thx, I created a test for the solaris module and build a new pre release: https://github.com/threez/ruby-vmstat/releases/download/v2.2.0-5/vmstat-2.2.0.pre.5.gem

@krzaczek
Copy link
Author

/opt/local/lib/ruby/gems/2.1.5/gems/vmstat-2.2.0.pre.5/lib/vmstat/solaris.rb:35:in `memory': undefined local variable or method `pagesize' for Vmstat::Solaris:Module (NameError)
        from /opt/local/lib/ruby/gems/2.1.5/gems/vmstat-2.2.0.pre.5/lib/vmstat/solaris.rb:70:in `memory'
        from /opt/local/lib/ruby/gems/2.1.5/gems/vmstat-2.2.0.pre.5/lib/vmstat/snapshot.rb:28:in `initialize'
        from /opt/local/lib/ruby/gems/2.1.5/gems/vmstat-2.2.0.pre.5/lib/vmstat.rb:82:in `new'
        from /opt/local/lib/ruby/gems/2.1.5/gems/vmstat-2.2.0.pre.5/lib/vmstat.rb:82:in `snapshot'
        from -e:1:in `<main>'

@threez
Copy link
Owner

threez commented Aug 10, 2016

Does this work? ruby -rvmstat -e 'p Vmstat.pagesize'

@krzaczek
Copy link
Author

Yes

[root@gitlab ~]# ruby -rvmstat -e 'p Vmstat.pagesize'
4096

threez pushed a commit that referenced this issue Aug 10, 2016
@threez
Copy link
Owner

threez commented Aug 10, 2016

Okay, think it's fixed. https://github.com/threez/ruby-vmstat/releases/download/v2.2.0-6/vmstat-2.2.0.pre.6.gem. Debugging/testing remotely is really fun :-)

@krzaczek
Copy link
Author

Works

[root@gitlab /tmp]# ruby -rvmstat -rpp -e "pp Vmstat.snapshot(['/'])"
#<Vmstat::Snapshot:0x00000000c76bb8
 @at=2016-08-10 20:50:18 +0200,
 @boot_time=2016-08-03 20:50:51 +0200,
 @cpus=
  [#<struct Vmstat::Cpu
    num=0,
    user=64973989,
    system=89226830,
    nice=0,
    idle=2328234987>,
   #<struct Vmstat::Cpu
    num=1,
    user=78274183,
    system=78562105,
    nice=0,
    idle=2325599266>,
   #<struct Vmstat::Cpu
    num=2,
    user=38633736,
    system=50669851,
    nice=0,
    idle=2393131956>,
   #<struct Vmstat::Cpu
    num=3,
    user=42593601,
    system=46096625,
    nice=0,
    idle=2393745315>,
   #<struct Vmstat::Cpu
    num=4,
    user=18840731,
    system=24009558,
    nice=0,
    idle=2439585250>,
   #<struct Vmstat::Cpu
    num=5,
    user=17816227,
    system=25658051,
    nice=0,
    idle=2438961258>,
   #<struct Vmstat::Cpu
    num=6,
    user=22344067,
    system=24442161,
    nice=0,
    idle=2435649306>,
   #<struct Vmstat::Cpu
    num=7,
    user=20915384,
    system=28124997,
    nice=0,
    idle=2433395151>,
   #<struct Vmstat::Cpu
    num=8,
    user=15426568,
    system=20824214,
    nice=0,
    idle=2446184747>,
   #<struct Vmstat::Cpu
    num=9,
    user=15029879,
    system=23813787,
    nice=0,
    idle=2443591861>,
   #<struct Vmstat::Cpu
    num=10,
    user=21789968,
    system=30093730,
    nice=0,
    idle=2430551827>,
   #<struct Vmstat::Cpu
    num=11,
    user=20201769,
    system=27418499,
    nice=0,
    idle=2434815254>,
   #<struct Vmstat::Cpu
    num=12,
    user=15312979,
    system=21302587,
    nice=0,
    idle=2445819955>,
   #<struct Vmstat::Cpu
    num=13,
    user=13942451,
    system=22106133,
    nice=0,
    idle=2446386934>,
   #<struct Vmstat::Cpu
    num=14,
    user=21296732,
    system=23379847,
    nice=0,
    idle=2437758937>,
   #<struct Vmstat::Cpu
    num=15,
    user=19853222,
    system=27080895,
    nice=0,
    idle=2435501397>,
   #<struct Vmstat::Cpu
    num=16,
    user=21003876,
    system=21859342,
    nice=0,
    idle=2439572293>,
   #<struct Vmstat::Cpu
    num=17,
    user=17583386,
    system=29611795,
    nice=0,
    idle=2435240328>,
   #<struct Vmstat::Cpu
    num=18,
    user=13620439,
    system=18502249,
    nice=0,
    idle=2450312819>,
   #<struct Vmstat::Cpu
    num=19,
    user=12564153,
    system=20406347,
    nice=0,
    idle=2449465005>,
   #<struct Vmstat::Cpu
    num=20,
    user=18729363,
    system=20999703,
    nice=0,
    idle=2442706436>,
   #<struct Vmstat::Cpu
    num=21,
    user=18787055,
    system=26092352,
    nice=0,
    idle=2437556093>,
   #<struct Vmstat::Cpu
    num=22,
    user=12796399,
    system=18740784,
    nice=0,
    idle=2450898315>,
   #<struct Vmstat::Cpu
    num=23,
    user=13077860,
    system=21534613,
    nice=0,
    idle=2447823023>,
   #<struct Vmstat::Cpu
    num=24,
    user=19833602,
    system=22291988,
    nice=0,
    idle=2440309903>,
   #<struct Vmstat::Cpu
    num=25,
    user=19217789,
    system=26778166,
    nice=0,
    idle=2436439536>,
   #<struct Vmstat::Cpu
    num=26,
    user=13387146,
    system=19643532,
    nice=0,
    idle=2449404811>,
   #<struct Vmstat::Cpu
    num=27,
    user=13576456,
    system=21840667,
    nice=0,
    idle=2447018363>,
   #<struct Vmstat::Cpu
    num=28,
    user=20506881,
    system=23152337,
    nice=0,
    idle=2438776266>,
   #<struct Vmstat::Cpu
    num=29,
    user=19989557,
    system=27228336,
    nice=0,
    idle=2435217589>,
   #<struct Vmstat::Cpu
    num=30,
    user=14689616,
    system=20334412,
    nice=0,
    idle=2447411451>,
   #<struct Vmstat::Cpu
    num=31,
    user=14414367,
    system=22541226,
    nice=0,
    idle=2445479884>],
 @disks=
  [#<struct Vmstat::LinuxDisk
    type=nil,
    origin="/",
    mount="/",
    block_size=131072,
    free_blocks=181855047,
    available_blocks=181855047,
    total_blocks=234681456>],
 @load_average=
  #<struct Vmstat::LoadAverage
   one_minute=0.08984375,
   five_minutes=0.03515625,
   fifteen_minutes=0.0234375>,
 @memory=
  #<struct Vmstat::Memory
   pagesize=4096,
   wired=4994291,
   active=2257869,
   inactive=0,
   free=5316623,
   pageins=0,
   pageouts=0>,
 @network_interfaces=
  [#<struct Vmstat::NetworkInterface
    name=:net0,
    in_bytes=4613406330,
    in_errors=0,
    in_drops=0,
    out_bytes=26563972625,
    out_errors=0,
    type=6>]>

@threez
Copy link
Owner

threez commented Aug 10, 2016

okay, thx for your help. I will prepare then a new release.

@threez threez closed this as completed Aug 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants