Page 1 of 2

VM Swap file - how do I increase the size?

Posted: Fri Oct 10, 2014 11:12 am
by SteveBeauchemin
Hey support gurus,

I am moving tests from an old Nagios Open Source system to a new, paid for, Nagios XI setup. I am trying to use appropriate sizing of RAM and Disk in the VM that was downloaded from Nagios. I used the ovf template and had it put into our ESX environment. The old system was using 10GB RAM with all the tests running, but I do not believe I should just set the new system to that level until is shows signs of needing that much resource. Also I am using Gearman now and hope that the system does not need the same resource allocations.

So, as I add tests to the new setup, I changed RAM to 4GB, and now to 6GB RAM in vCenter. But I just realized that the swap file is still set to 2GB. I believe that the swap file on the CentOS image I downloaded from Nagios needs to be changed to 8GB if I have 6GB RAM assigned.

Are there instruction available to increase the swap file size on the VM from 2GB to 8 GB?

Thanks.

Steve B

Re: VM Swap file - how do I increase the size?

Posted: Fri Oct 10, 2014 3:59 pm
by sreinhardt
Let's take this one step at a time. Since you are using the prebuilt vm, the disk size is also rather small unless you have already performed a resize. I would suggest we start with increasing the overall disk size, then we can shrink the data lvm partition to increase the swap partition. Please follow the document linked below for disk resizing instructions.

http://assets.nagios.com/downloads/nagi ... M_Disk.pdf

Re: VM Swap file - how do I increase the size?

Posted: Fri Oct 10, 2014 4:05 pm
by Box293
The steps in this document:

http://assets.nagios.com/downloads/nagi ... M_Disk.pdf

are for resizing the VM's virtual disk. These aren't the exact procedures to resize the swap, however if I'm right you need to resize the filesystem used by the swap.

Re: VM Swap file - how do I increase the size?

Posted: Fri Oct 10, 2014 4:40 pm
by WillemDH
Fyi. The later images of XI has volumes named lv_swap and lv_root, not VolGroup00-LogVol00 (root) and VolGroup00-LogVol01 (swap) for root. Noticed this on my qa xi server. And you should take a VM snapshot before you start (after expanding the disk in VMWare, as normally you can't expand the disk when there is a snapshot..) :)

Re: VM Swap file - how do I increase the size?

Posted: Fri Oct 10, 2014 5:01 pm
by lmiltchev
Replace all instances of "/dev/mapper/VolGroup00-LogVol00" with "/dev/mapper/VolGroup-lv_root" in the document's commands.

Code: Select all

lvresize /dev/mapper/VolGroup-lv_root /dev/sda2
resize2fs /dev/mapper/VolGroup-lv_root
And you should take a VM snapshot before you start (after expanding the disk in VMWare, as normally you can't expand the disk when there is a snapshot..)
Yes, unfortunately this is true. Maybe you can clone the VM & rename it.

Re: VM Swap file - how do I increase the size?

Posted: Fri Oct 10, 2014 5:12 pm
by WillemDH
Yes, unfortunately this is true. Maybe you can clone the VM & rename it.
At my work I don't need to take a clone. If you first shutdown the server, then expand the disk in VMWare (edit settings, edit disk size) and then take a snapshot you should be ok. Please correct me if I'm wrong Ludmill.

Grtz

Re: VM Swap file - how do I increase the size?

Posted: Fri Oct 10, 2014 5:16 pm
by abrist
The point of the clone is to make sure you have backup machine just in case the some *horrible* goes wrong. We don't like being blamed or feeling responsible for data loss, so we will always suggest backups (in the extreme!!!).

Re: VM Swap file - how do I increase the size?

Posted: Mon Oct 13, 2014 2:15 am
by WillemDH
Cloning it will be (in the future)..

Grtz

Re: VM Swap file - how do I increase the size?

Posted: Tue Oct 14, 2014 10:52 am
by tmcdonald
Talking with Steve at the conference as I type this - unlocking the thread since he has not checked on it since getting here. He has not had time to try lmiltchev's suggestion.

Re: VM Swap file - how do I increase the size?

Posted: Fri Oct 31, 2014 1:57 pm
by SteveBeauchemin
This item can be closed as it is now no longer an issue that I have to deal with. I have turned it over to my local UNIX Server support team and they will deal with the change. It's what they do.

Thanks for all the other suggestions.

I have a suggestion too: Keep in mind that if you really need a swap file change, then maybe you don't have enough RAM or some other settings need to be changed.

In my case, as I add items to Nagios XI, the underlying host resources do not change automatically. I needed to be aware of Linux Admin stuff and make changes. I had to learn another job basically.

Increasing RAM to 6GB and changing some kernel parameters fixed my problem so far. I changed /etc/sysctl.conf and /etc/security/limits.conf to solve my real problem. I know the reason for my request was never actually provided, but my system was hanging up every so often, for maybe an hour or so sometimes. It seems that I monitor too many things and the DB was too slow to keep up - hah.

So, here is my /var/log/messages line that gave me a clue as to what needed to change.
Syslog lines follow:

<code>
ndo2db: Warning: Retrying message send. This can occur because you have too few messages allowed or too few total bytes allowed in message queues. You are currently using 256000 of 512000 messages and 262144000 of 262144000 bytes in the queue. See README for kernel tuning options.
ndo2db: Error: max retries exceeded sending message to queue. Kernel queue parameters may neeed to be tuned. See README.
ndo2db: Warning: queue send error, retrying...
</code> (bad spelling is in the file - I did not retype it - copy/pasted here and added the bold)

The following lines reflect my changes slowly trying to fix the problem by increasing some settings. I have increased them again since this happened.
So - in /etc/sysctl.conf I have this now. (increased slowly over time)
<code>
# Controls the default maximum size of a message queue
# 256 MB
#kernel.msgmnb = 268435456
#512 MB
#kernel.msgmnb = 536870912
# 768 MB
kernel.msgmnb = 805306368
</code>
to activate the change after edit, enter:
sysctl -p

I have also increased the number of open files allowed by changing /etc/security/limits.conf (reboot required after change)
I needed to do this on my older system a while back because of the large number of tests running.
<code>
* soft nofile 8192 #open files
* hard nofile 63536
</code>

So, all said and done, :idea: maybe Nagios XI should come with some self awareness built in - and make it really obvious to us that something needs to be changed to make the system perform better based upon the amount of monitored hosts and services. Cause we are not all SysAdmins. Some of us are just Monitoring folks.

Like I said, you can close this, and I hope other folks learn from my troubles.

I still have about 40,000 more tests to transition from my old system. (yup 40K :!: ) But I am re engineering many of them to use less line items in the XI GUI. I am sure to be increasing settings again at some point. Who knows, maybe there is a better way to deal with my problem here, but so far this is working.

Thanks for reading.

Steve B