Uploaded image for project: 'Observium'
  1. Observium
  2. OBS-757

Purge script for the eventlog and syslog tables

Details

    • Improvement
    • Resolution: Fixed
    • Minor
    • None
    • None
    • Poller
    • None
    • Observium 5134, Python 2.7.5

    Description

      Here is a simple purge script that removes entries in the eventlog and syslog tables older than a given interval.

      Attachments

        1. db-maintenance.php
          6 kB
        2. db-maintenance.php
          6 kB
        3. purge.py
          5 kB

        Activity

          [OBS-757] Purge script for the eventlog and syslog tables

          Yes, discovery.php, poller and all of my own scripts work. I've verified ownership permissions and selinux is all set the same as discovery.php as well. I'm stumped, I've even gone over the file for syntax errors and while I've replaced a few possible things, nothing has helped.

          slm4996 Solomon Seal added a comment - Yes, discovery.php, poller and all of my own scripts work. I've verified ownership permissions and selinux is all set the same as discovery.php as well. I'm stumped, I've even gone over the file for syntax errors and while I've replaced a few possible things, nothing has helped.

          I bet it has to do with

          chdir(dirname(__FILE__));

          Try changing it to

          chdir(dirname($argv[0]));

          What version of PHP are you using?

          moorereason Cameron Moore added a comment - I bet it has to do with chdir(dirname(__FILE__)); Try changing it to chdir(dirname($argv[0])); What version of PHP are you using?

          Solomon,
          Weird. I've been running it the whole time without using php in the command line like that. The beginning of the file is exactly like discovery.php. Does discovery.php work?

          moorereason Cameron Moore added a comment - Solomon, Weird. I've been running it the whole time without using php in the command line like that. The beginning of the file is exactly like discovery.php. Does discovery.php work?

          Nice, an odd thing on my system. When running I have to execute it like

          /opt/observium # php db-maintenance.php -r                                                                                                                                                          Table "devices_perftimes" has 5,723,433 records using 371.44 Mb
          Table "eventlog" has 19,797 records using 9.30 Mb
          Table "perf_times" has 5,659,049 records using 375.44 Mb
          Table "syslog" has 1,284,730 records using 788.94 Mb
          

          If I run it like run all the rest of my php scripts (by successfully allowing env to load php) it fails like so:

          /opt/observium # ./db-maintenance.php -r                                                                                                                                                            
          : No such file or directory
          

          slm4996 Solomon Seal added a comment - Nice, an odd thing on my system. When running I have to execute it like /opt/observium # php db-maintenance.php -r Table "devices_perftimes" has 5,723,433 records using 371.44 Mb Table "eventlog" has 19,797 records using 9.30 Mb Table "perf_times" has 5,659,049 records using 375.44 Mb Table "syslog" has 1,284,730 records using 788.94 Mb If I run it like run all the rest of my php scripts (by successfully allowing env to load php) it fails like so: /opt/observium # ./db-maintenance.php -r : No such file or directory

          Uploading a new version.

          Original version used

          dbFetch("SELECT COUNT(*) FROM...")

          in show_table_interval_report() when I should have used dbFetchCell().

          moorereason Cameron Moore added a comment - Uploading a new version. Original version used dbFetch("SELECT COUNT(*) FROM...") in show_table_interval_report() when I should have used dbFetchCell().

          I'm attaching a PHP script inspired by Mathieu's Python script.

          Run the script with no options to see the help output. Should be self-explanatory.

          moorereason Cameron Moore added a comment - I'm attaching a PHP script inspired by Mathieu's Python script. Run the script with no options to see the help output. Should be self-explanatory.

          we will not commit perl. observium is written in php.

          adama Adam Armstrong added a comment - we will not commit perl. observium is written in php.

          New version with perf_times and devices_perftimes purge support.

          kedare Mathieu Poussin (K3dare) added a comment - New version with perf_times and devices_perftimes purge support.

          Something like this would be great to see incorporated. I've been using my own script, not as elegant as this to keep my syslog trimmed.

          slm4996 Solomon Seal added a comment - Something like this would be great to see incorporated. I've been using my own script, not as elegant as this to keep my syslog trimmed.

          People

            sid3windr Tom Laermans
            kedare Mathieu Poussin (K3dare)
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: