VM Swap file - how do I increase the size?

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
SteveBeauchemin
Posts: 524
Joined: Mon Oct 14, 2013 7:19 pm

VM Swap file - how do I increase the size?

Post 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
XI 5.7.3 / Core 4.4.6 / NagVis 1.9.8 / LiveStatus 1.5.0p11 / RRDCached 1.7.0 / Redis 3.2.8 /
SNMPTT / Gearman 0.33-7 / Mod_Gearman 3.0.7 / NLS 2.0.8 / NNA 2.3.1 /
NSClient 0.5.0 / NRPE Solaris 3.2.1 Linux 3.2.1 HPUX 3.2.1
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

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

Post 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
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

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

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
WillemDH
Posts: 2320
Joined: Wed Mar 20, 2013 5:49 am
Location: Ghent
Contact:

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

Post 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..) :)
Nagios XI 5.8.1
https://outsideit.net
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

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

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
WillemDH
Posts: 2320
Joined: Wed Mar 20, 2013 5:49 am
Location: Ghent
Contact:

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

Post 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
Last edited by WillemDH on Sun Oct 12, 2014 4:58 am, edited 1 time in total.
Nagios XI 5.8.1
https://outsideit.net
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

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

Post 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!!!).
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
User avatar
WillemDH
Posts: 2320
Joined: Wed Mar 20, 2013 5:49 am
Location: Ghent
Contact:

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

Post by WillemDH »

Cloning it will be (in the future)..

Grtz
Nagios XI 5.8.1
https://outsideit.net
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

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

Post 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.
Former Nagios employee
SteveBeauchemin
Posts: 524
Joined: Mon Oct 14, 2013 7:19 pm

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

Post 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
XI 5.7.3 / Core 4.4.6 / NagVis 1.9.8 / LiveStatus 1.5.0p11 / RRDCached 1.7.0 / Redis 3.2.8 /
SNMPTT / Gearman 0.33-7 / Mod_Gearman 3.0.7 / NLS 2.0.8 / NNA 2.3.1 /
NSClient 0.5.0 / NRPE Solaris 3.2.1 Linux 3.2.1 HPUX 3.2.1
Locked