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

          Use housekeeping script.
          Added in r5653.

          landy Mike Stupalov added a comment - Use housekeeping script. Added in r5653.

          Tom,
          It looks like you can close this issue now that the housekeeping script was adding in r5653.

          moorereason Cameron Moore added a comment - Tom, It looks like you can close this issue now that the housekeeping script was adding in r5653.

          Solomon,
          Did you ever figure out why this script was failing for you? If not, your next step is probably to setup Xdebug and VIM to step through the script from the command line to see where it's flaming out.

          moorereason Cameron Moore added a comment - Solomon, Did you ever figure out why this script was failing for you? If not, your next step is probably to setup Xdebug and VIM to step through the script from the command line to see where it's flaming out.

          Can you run it without arguments?

          sh# ./db-maintenance.php

          I'm stumped, too. Can you jump on IRC to troubleshoot? My nick is moorereason. I'm on PHP 5.3.

          moorereason Cameron Moore added a comment - Can you run it without arguments? sh# ./db-maintenance.php I'm stumped, too. Can you jump on IRC to troubleshoot? My nick is moorereason. I'm on PHP 5.3.

          Nope, I switched that out as the newer versions of discovery use

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

          . I have PHP 5.4.4-14

          slm4996 Solomon Seal added a comment - Nope, I switched that out as the newer versions of discovery use chdir(dirname($argv[0])); . I have PHP 5.4.4-14

          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().

          People

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

            Dates

              Created:
              Updated:
              Resolved: