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

Add sysctl_mem option for FreeBSD #723

Closed
wants to merge 3 commits into from

Conversation

xbeaudouin
Copy link
Contributor

Thank you for your interest in contributing to Checkmk!
Consider looking into Readme regarding process details.

General information

This rework from Brad works on PR#578 and new PR from #696, with Allan suggestions.

Proposed changes

Making a sysctl_mem option per default.
This permit to have information using sysctl information in addition of other way to have this.
Since sysctl is always present on FreeBSD this information is alway given.

We should have a new section giving the following informations:

<<<sysctl_mem>>>
mem.cache 0
mem.free 188102864896
mem.total 274779779072
mem.used 79134859264
swap.free 8589934592
swap.total 8589934592
swap.used 0

Kind regards

@xbeaudouin
Copy link
Contributor Author

Hello, any news about this PR ? Thanks

@xbeaudouin
Copy link
Contributor Author

Dear check_mk maintainers, is there any news about this PR ?
Kind regards

@xbeaudouin
Copy link
Contributor Author

@mo-ki Hello, any news about this PR? We discussed a lot on this previously...
Kind regards

@mo-ki
Copy link
Contributor

mo-ki commented Sep 9, 2024

Hi, sorry about the silence. I was on vacation. I haven't forgotten about this, but we're currently struggling with limited resources....

@mo-ki
Copy link
Contributor

mo-ki commented Sep 9, 2024

But I think my comments from #578 still remain valid.

@xbeaudouin
Copy link
Contributor Author

Well sorry about pinged you on holidays, I hope the holidays was nice !
Well this PR is #696, that took your comments from #578 in consideration.

Really I hope this can be merged if possible. In the meantime I will add this PR on FreeBSD ports.

@mo-ki
Copy link
Contributor

mo-ki commented Sep 11, 2024

Oh, I see. In this case:

  • The section in the agent should be enclosed in a function (that should be the case for all sections, but we're not there yet...)
  • A parse function needs to be implemented in https://github.com/Checkmk/checkmk/blob/master/cmk/plugins/collection/agent_based/mem_used_sections.py
  • Interpretation and computations should be left to the parse function. The section can simply output all the required values: sysctl vm.stats.vm.v_page_size vm.stats... 2>&1.

@xbeaudouin
Copy link
Contributor Author

Oh, I see. In this case:

* The section in the agent should be enclosed in a function (that should be the case for all sections, but we're not there yet...)

* A parse function needs to be implemented in `https://github.com/Checkmk/checkmk/blob/master/cmk/plugins/collection/agent_based/mem_used_sections.py`

* Interpretation and computations should be left to the parse function. The section can simply output all the required values:  `sysctl vm.stats.vm.v_page_size vm.stats... 2>&1`.

This has been done.

@xbeaudouin
Copy link
Contributor Author

Hello,
Some news ? @mo-ki ?
Kind regards

@mo-ki
Copy link
Contributor

mo-ki commented Oct 21, 2024

My intend is to gather some example output, write some tests and merge this in about 2-3 weeks.
Can you give me some example agent output? In the snipped I saw, "free" and "used" did not sum up to "total". Can you confirm / any idea why?

@xbeaudouin
Copy link
Contributor Author

Some examples as requested:

Machine 1:

<<<sysctl_mem>>>
mem.cache 0
mem.free 68687077376
mem.total 233930469376
mem.used 140793962496
swap.free 4294967296
swap.total 4294967296
swap.used 0

Top sample

Mem: 2411M Active, 18G Inact, 4560M Laundry, 129G Wired, 112K Buf, 64G Free
ARC: 114G Total, 72G MFU, 35G MRU, 66M Anon, 2137M Header, 4410M Other
     102G Compressed, 156G Uncompressed, 1.53:1 Ratio
Swap: 4096M Total, 4096M Free

The sum of mem free and mem used is not mem total because you can have some inactive RAM in this example.

Machine 2:

<<<sysctl_mem>>>
mem.cache 0
mem.free 7805911040
mem.total 63682101248
mem.used 47276253184
swap.free 2147483648
swap.total 2147483648
swap.used 0

Top sample:

Mem: 2437M Active, 8162M Inact, 42G Wired, 104K Buf, 7444M Free
ARC: 39G Total, 11G MFU, 27G MRU, 76M Anon, 156M Header, 366M Other
     37G Compressed, 73G Uncompressed, 1.96:1 Ratio

The total of used memory is ~51G on a 65G machine

Notice the idea if at the begining to show allow libstatgrab compatible output.

@mo-ki
Copy link
Contributor

mo-ki commented Oct 29, 2024

Hm. The used check plugin only expects to be provided with MemFree and MemTotal. It will compute the used memory from that. Would that be acceptable here? Or should we rather subtract the "inactive" memory from the reported total? I am not familiar with the concept of "inactive" memory, I am afraid :-(

@xbeaudouin
Copy link
Contributor Author

Inactive memory is memory allocated by some process but not used yet. It is mostly "ready" to be paged on swap if needed.
So MemTotal present the total memory on the server, and MenFree the total available free memory to be used. So I think this is ok for me.
I know the concept of active / inactive memory can be puzzling !
More informations : https://docs.freebsd.org/en/books/arch-handbook/vm/

@mo-ki
Copy link
Contributor

mo-ki commented Oct 31, 2024

Ok, then the agent section can be streamlined a bit. Don't worry about that and the red tests, I'll take it from here :-)

freebsd-git pushed a commit to freebsd/freebsd-ports that referenced this pull request Nov 1, 2024
PR:		281384
Approved by:	Ian Valentine <[email protected]> (maintainer)
See:		Checkmk/checkmk#723
@xbeaudouin
Copy link
Contributor Author

Thanks @mo-ki, don't hesitate to keep me in touch in case you need anything

@CheckmkCI CheckmkCI closed this in b1fb542 Nov 7, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Nov 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants