Open inferiorhumanorgans opened 8 years ago
@inferiorhumanorgans I see that we rewrote that check anyways, can you test it against master?
might be fixed with just a release which has been requested in #54
2.0.0 has the rewritten swap check. Can you try that and feel free to reopen if still a problem.
Well free(1) is Linux only, so I can't imagine it works.
@inferiorhumanorgans correct sorry I didnt look inside to see that it was simply shelling out for free to get that, we should look into a cross platform way to do this.
@eheydrick please repopen
This might be a good way to go:
@inferiorhumanorgans I used that one for cross platform ram checking, looks like there was some stuff just merged using /proc/meminfo
assuming you have that on your *nix system if I get some time next week to take a look at it I will.
procfs is pretty much always guaranteed to be platform dependent.
@inferiorhumanorgans can you check out #57 and see if that works for you? Its certainly rough around the edges but wanted to see if I could just get something working for you.
$ uname -sr
FreeBSD 10.3-RELEASE-p11
$ file /proc/swaps
/proc/swaps: cannot open `/proc/swaps' (No such file or directory)
$ uname -sr
Darwin 13.4.0
$ file /proc/swaps
/proc/swaps: cannot open `/proc/swaps' (No such file or directory)
I'd suggest using an existing abstraction layer. Procfs is inherently operating system dependent and rarely (if ever) considered cross-platform. ruby-vmstat that I linked to above is MIT licensed and claims explicit support for:
@inferiorhumanorgans sorry I misread your initial comment. Agreed, however I checked and the vmstat did not look like it had swap support unless I am missing something.
Ah, true. However, the same problems apply to the other memory checks in this repo as it looks like they rely on free(1)
.
I did find this: https://github.com/djberg96/sys-filesystem that does work except that it does not detect swap so if we can detect all the swap paths/devices then we could use that. I will dig more when I have some more free time.
@inferiorhumanorgans check-ram uses vmstat gem and does not rely on free
but yes I totally agree and would love to invest time when I have it if I can find a reasonable path.
Yeah, I'd go for some/more coverage especially as the vmstat gem is already being used here and checking swap info is well within scope per their readme.
yup it looks like its on the todo list