Huge files in /var.

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
prateekagr1988
Posts: 62
Joined: Fri Sep 26, 2014 7:21 pm

Huge files in /var.

Post by prateekagr1988 »

2903.2MB 2014-12-15 mysql /var/lib/mysql/nagios/nagios_commenthistory.MYD
2896.2MB 2014-12-15 mysql /var/lib/mysql/nagios/nagios_commenthistory.TMD
548.3MB 2014-12-15 mysql /var/lib/mysql/nagios/nagios_statehistory.MYD
468.0MB 2014-12-08 nagios /var/spool/mail/nagios
344.1MB 2014-12-15 mysql /var/lib/mysql/nagios/nagios_commenthistory.MYI

Please suggest on how to housekeep those, and re-direct to a different file system from /var.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Huge files in /var.

Post by abrist »

Files located in the directory: /var/lib/mysql/nagios are tables. You could truncate those tables, or decrease their retention window through Admin --> Performance --> Databases.
prateekagr1988 wrote:Please suggest on how to housekeep those, and re-direct to a different file system from /var.
Well, you would need to move the default location for the database files. Have you considered creating a new mount for /var? Nagios XI systems will make heavy use of /usr and /var.
prateekagr1988 wrote:468.0MB 2014-12-08 nagios /var/spool/mail/nagios
Empty the mail file . . .
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.
prateekagr1988
Posts: 62
Joined: Fri Sep 26, 2014 7:21 pm

Re: Huge files in /var.

Post by prateekagr1988 »

Thanks for the inputs !
Could you suggest what all can be moved from /usr and /var to different file systems ?
We have been asked to move all the application specific data to different mounts (and not use / or /var or /usr).
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Huge files in /var.

Post by abrist »

This is possible with symlinks.
Data in /usr/local:

Code: Select all

/nagios
/nagiosxi
/nagiosmobile
/nagvis
/nrdp
Data in /var:

Code: Select all

/lib/mrtg
/lib/mysql
/lib/pgsql
Various logs in /var/log.
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.
prateekagr1988
Posts: 62
Joined: Fri Sep 26, 2014 7:21 pm

Re: Huge files in /var.

Post by prateekagr1988 »

Yes.. that's a good suggestion :)
So I should stop Nagios, and create the entire file structure in a different location ? or how does it work ?
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Huge files in /var.

Post by abrist »

Symbolic Links:
http://en.wikipedia.org/wiki/Symbolic_link
http://www.cyberciti.biz/tips/understan ... links.html
prateekagr1988 wrote:So I should stop Nagios, and create the entire file structure in a different location ? or how does it work ?
This is something your linux admins should be able to help you with. It can be different in different environments.
Usually you create the folders somewhere else in your filesystem (on a different mount usually). Stop all relevant services, and then move/copy all the data from each folder to the new respective folder in the mount directory. You then create a symbolic links to the new directories and restart services.

Just an FYI: Doing this is technically unsupported though we will do what we can to help. Just beware that if you are new to linux, you may want to do some reading before going about creating mounts, moving XI files, and setting up symlinks.
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.
prateekagr1988
Posts: 62
Joined: Fri Sep 26, 2014 7:21 pm

Re: Huge files in /var.

Post by prateekagr1988 »

Creating of new FS is managed by our unix admins here, and I am fairly aware of unix.. so should not be an issue.. I would like to understand, what all should be stopped ideally.. when I move those files in /usr and /var (including the backups generated in /store)..
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Huge files in /var.

Post by abrist »

prateekagr1988 wrote:and I am fairly aware of unix
Gotchya, my apologies.
prateekagr1988 wrote:what all should be stopped ideally

Code: Select all

nagios
ndo2db
mysqld
postgresql
npcd
httpd
crond
xinetd
I think that should be all of the services . . .
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.
prateekagr1988
Posts: 62
Joined: Fri Sep 26, 2014 7:21 pm

Re: Huge files in /var.

Post by prateekagr1988 »

No worries. :)
Do we have any reference document which gives a fair idea of such kind of tweaks and suggestions to improve the performance of Nagios ?
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: Huge files in /var.

Post by sreinhardt »

Here's one good example document we have. Other things you can look into are ramdisks, rrdcached, offloading mysql and ndo2db, possibly addition of mod_gearman for distributing checks. Take your time and assess what you really need to implement before jumping on all of these though.

http://assets.nagios.com/downloads/nagi ... ios-XI.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.
Locked