reducing size of nagios_logentries,MYI & MYD

An open discussion forum for obtaining help with Nagios Core. Nagios Core users of all experience levels are welcome here. Subforum have been created for the discussion of Nagios Core and Nagios Plugin development.

NOTE: The SourceForge.net mailing lists have been deprecated in favor of this forum in order to expedite support and provide additional features not available on the old mailing list.

reducing size of nagios_logentries,MYI & MYD

Postby Nighthawkz » Tue Jan 09, 2018 7:54 am

This seems like it should be quite a simple problem I shouldn't need to ask for an answer, but...


Running into some disk space issues on my nagios server. I've reduced/removed everything else I can but the server is showing the following files as being very large

1.1G ./nagios_statehistory.MYD
2.9G ./nagios_logentries.MYI
4.3G ./nagios_logentries.MYD

Tried searching on this forum and come across similar topics, but for some reason it says i do not have permission not view this thread for every post I go onto so i haven't been able to research properly.

Anyway - I've looked at the entires in this table - as far as i'm concerned entires from 6 months and older can go, so Is it safe to just delete any entires before a date I'm happy with? or use something like the OPTIMIZE TABLE command to try and reclaim space (if there is any - i dont' often play with the admin side of MySql but this is how i understand the command)

Or is there a specific way relating to how nagios uses these tables , that i should be aware of before reducing there size?

Thansk for any help

Regards
Nighthawkz
 
Posts: 21
Joined: Fri Oct 20, 2017 7:05 am

Re: reducing size of nagios_logentries,MYI & MYD

Postby dwhitfield » Tue Jan 09, 2018 1:21 pm

Are you using Core with ndo, or XI? You put this in the Core forum, so I just want to make sure I get you specific instructions.

If using XI, please see https://assets.nagios.com/downloads/nag ... zation.pdf
dwhitfield
Former Nagios Staff
 
Posts: 4569
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN

Re: reducing size of nagios_logentries,MYI & MYD

Postby Nighthawkz » Thu Jan 11, 2018 7:56 am

@dwhitfield

Thanks for replying. It's ndo I believe (it's definitely not XI anyway)

Regards
Nighthawkz
 
Posts: 21
Joined: Fri Oct 20, 2017 7:05 am

Re: reducing size of nagios_logentries,MYI & MYD

Postby dwhitfield » Thu Jan 11, 2018 5:35 pm

Take a backup first, but yes it should be fine. The log entries are in the literal logs anyway, so those you have if you need them. Can you give is a screenshot of your ui so we have a better idea of what's going on? What version of core are you running?
dwhitfield
Former Nagios Staff
 
Posts: 4569
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN

Re: reducing size of nagios_logentries,MYI & MYD

Postby Nighthawkz » Mon Jan 29, 2018 11:21 am

@dwhitfield

apologies for late reply

I'm using nagios core version 4.0.7. i've added the actual disk space message. what else would be useful interms of the UI?

regards
Attachments
Capture.JPG
Nighthawkz
 
Posts: 21
Joined: Fri Oct 20, 2017 7:05 am

Re: reducing size of nagios_logentries,MYI & MYD

Postby dwhitfield » Mon Jan 29, 2018 12:25 pm

What is the output of the following:
Code: Select all
du -shcx /usr/local/nagios/*
du -shcx /var/lib/*
df -h
df -i


Please put the output in a code block. The "Code" button is the fifth from the left on the post input screen (between Quote and List).
dwhitfield
Former Nagios Staff
 
Posts: 4569
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN

Re: reducing size of nagios_logentries,MYI & MYD

Postby Nighthawkz » Tue Jan 30, 2018 7:29 am

Code: Select all
nagios:~ # du -shcx /usr/local/nagios/*
1.4M    /usr/local/nagios/bin
4.3M    /usr/local/nagios/etc
4.0K    /usr/local/nagios/include
396K    /usr/local/nagios/lib
9.0M    /usr/local/nagios/libexec
8.0K    /usr/local/nagios/logs
4.6M    /usr/local/nagios/sbin
3.1M    /usr/local/nagios/share
42M     /usr/local/nagios/var
65M     total


Code: Select all
nagios:~ # du -shcx /var/lib/*
16K     /var/lib/CAM
8.0K    /var/lib/PolicyKit
380K    /var/lib/PolicyKit-public
72K     /var/lib/YaST2
4.0K    /var/lib/apache2
4.0K    /var/lib/arpd
28K     /var/lib/autoinstall
8.0K    /var/lib/dbus
12K     /var/lib/dhcpcd
4.0K    /var/lib/empty
300K    /var/lib/hardware
4.0K    /var/lib/libuuid
988K    /var/lib/locatedb
4.0K    /var/lib/logrotate.status
8.0K    /var/lib/misc
12G     /var/lib/mysql
4.0K    /var/lib/mysql-files
16K     /var/lib/net-snmp
4.0K    /var/lib/news
20K     /var/lib/nfs
4.0K    /var/lib/nobody
56K     /var/lib/ntp
4.0K    /var/lib/pam_devperm
8.0K    /var/lib/pbl
4.0K    /var/lib/php5
8.0K    /var/lib/postfix
128K    /var/lib/puppet
12K     /var/lib/readonlyroot
12K     /var/lib/rpcbind
37M     /var/lib/rpm
100K    /var/lib/samba
28K     /var/lib/scpm
4.0K    /var/lib/smartmontools
4.0K    /var/lib/sshd
92K     /var/lib/sudo
8.0K    /var/lib/suseRegister
8.0K    /var/lib/syslog-ng
4.0K    /var/lib/wwwrun
20K     /var/lib/zypp
12G     total
Code: Select all
nagios:~ # df -i
Filesystem              Inodes IUsed  IFree IUse% Mounted on
/dev/mapper/system-root 390144 86071 304073   23% /
udev                         0     0      0     - /dev
tmpfs                   217170     1 217169    1% /dev/shm
/dev/sda1               128016    42 127974    1% /boot
/dev/mapper/system-var  916864  2978 913886    1% /var

Code: Select all
nagios:~ # df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/system-root  5.9G  2.4G  3.3G  42% /
udev                    1008M  120K 1008M   1% /dev
tmpfs                   1008M     0 1008M   0% /dev/shm
/dev/sda1                485M   22M  438M   5% /boot
/dev/mapper/system-var    15G   13G  1.4G  90% /var
nagios:~ #
Last edited by dwhitfield on Tue Jan 30, 2018 10:03 am, edited 1 time in total.
Reason: turned icode to code
Nighthawkz
 
Posts: 21
Joined: Fri Oct 20, 2017 7:05 am

Re: reducing size of nagios_logentries,MYI & MYD

Postby dwhitfield » Tue Jan 30, 2018 10:09 am

Some of https://assets.nagios.com/downloads/nag ... tabase.pdf won't apply because you are using Core, but you can see if the repair options that mysql offers resolve the issue. Also, the document goes through some tables which are "safe" to truncate. Ultimately, if you want to keep all of your data, you may need to increase the /var partition.
dwhitfield
Former Nagios Staff
 
Posts: 4569
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN

Re: reducing size of nagios_logentries,MYI & MYD

Postby Nighthawkz » Wed Jan 31, 2018 9:05 am

Thank you, I'll take a look through. to be honest we don't really want to keep years worth of data so I'll look into truncating those tables. and if not increasing the disk size.

thanks again!
Nighthawkz
 
Posts: 21
Joined: Fri Oct 20, 2017 7:05 am

Re: reducing size of nagios_logentries,MYI & MYD

Postby dwhitfield » Wed Jan 31, 2018 10:10 am

our optimization scripts are written for XI, but this might give you some ideas:

Code: Select all
    $optimize_interval = get_database_interval("ndoutils", "optimize_interval", 60);

    $optimize = false;
    $lastopt = get_meta(METATYPE_NONE, 0, "last_ndoutils_optimization");

    if ($lastopt == null) {
        $optimize = true;
        echo "NEVER OPTIMIZED\n";
    } else {
        $opt_time = ($lastopt + ($optimize_interval * 60));
        if ($now > $opt_time) {
            $optimize = true;
            echo "TIME TO OPTIMIZE\n";
        }
        echo "LASTOPT:  $lastopt\n";
        echo "INTERVAL: $optimize_interval\n";
        echo "NOW:      $now\n";
        echo "OPTTIME:  $opt_time\n";
    }

    if ($optimize_interval == 0) {
        echo "OPTIMIZE INTERVAL=0\n";
        $optimize = false;
    }

    if ($optimize == true) {
        foreach ($db_tables[DB_NDOUTILS] as $table) {
            echo "OPTIMIZING NDOUTILS TABLE: $table\n";
            optimize_table(DB_NDOUTILS, $table);
        }
        set_meta(METATYPE_NONE, 0, "last_ndoutils_optimization", $now);
    }




The full script in XI is called dbmaint.php, if you want some context.
dwhitfield
Former Nagios Staff
 
Posts: 4569
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN


Return to Nagios Core

Who is online

Users browsing this forum: No registered users and 39 guests