Welcome, Guest. Please login or register.

Author Topic: cyclic DB clean up  (Read 10588 times)

dobst

  • Full Member
  • ***
  • Posts: 144
    • View Profile
Re: cyclic DB clean up
« Reply #15 on: April 26, 2013, 09:31:09 AM »
Your're right, I am using the nedi user defined in nedi.conf but if it has not sufficient rights it can't clear mysql logs. But don't bother, it's also possible to adjust the log duration with

Code: [Select]
expire_logs_days = [days]
in the mysql config file my.cnf

See also http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html#sysvar_expire_logs_days

dobst

  • Full Member
  • ***
  • Posts: 144
    • View Profile
Re: cyclic DB clean up
« Reply #16 on: June 12, 2013, 03:07:18 PM »

rickli

  • Administrator
  • Hero Member
  • *****
  • Posts: 2496
    • View Profile
    • NeDi
Re: cyclic DB clean up
« Reply #17 on: June 12, 2013, 06:11:40 PM »
tx, added to 1.0.9 :)
Please consider Other-Invoices on your NeDi installation for an annual contribution, tx!
-Remo

dobst

  • Full Member
  • ***
  • Posts: 144
    • View Profile
Re: cyclic DB clean up
« Reply #18 on: July 04, 2013, 11:19:20 AM »
I'm extending the script to resolve switch dependencies e. g. rrd and config files. As there are no rrd and config files for access points, I need criteria to distinguish switchs with rrd/config files and access points with out. Which one can I take?

Code: [Select]
SELECT
    device
FROM
    devices
WHERE
    lastdis < $retire_before
    AND (is a device with rrd files)
;

rickli

  • Administrator
  • Hero Member
  • *****
  • Posts: 2496
    • View Profile
    • NeDi
Re: cyclic DB clean up
« Reply #19 on: July 04, 2013, 09:33:58 PM »
How about devopts? Haven't documented it yet, but NNN means nosnmpdev now. It could even be extended, when managed APs create RRDs some day...
Please consider Other-Invoices on your NeDi installation for an annual contribution, tx!
-Remo

dobst

  • Full Member
  • ***
  • Posts: 144
    • View Profile
Re: cyclic DB clean up
« Reply #20 on: July 11, 2013, 12:20:16 PM »
Would this be a good choice:

Code: [Select]
SELECT
    device
FROM
    devices
WHERE
    lastdis < $retire_before
    AND devopts NOT LIKE 'NNN'
;

Devopts for my selected devices are 'A--, '-C-' or ' 'AC-'. What does it mean?

rickli

  • Administrator
  • Hero Member
  • *****
  • Posts: 2496
    • View Profile
    • NeDi
Re: cyclic DB clean up
« Reply #21 on: July 12, 2013, 10:13:08 AM »
A=using standard IF alias, so Device-Status supports setting it via SNMP
C=CPU utilization, so rrdgraphs are shown, even if current value is 0
P=using Power-Ethernet MIB, so PoE budet can be calculated and ports enabled/disabled in Device-Status
Please consider Other-Invoices on your NeDi installation for an annual contribution, tx!
-Remo

dobst

  • Full Member
  • ***
  • Posts: 144
    • View Profile
Re: cyclic DB clean up
« Reply #22 on: July 12, 2013, 11:00:58 AM »
Thx for explaination. So is it correct that only for devices with the C flag rrd files are generated?

rickli

  • Administrator
  • Hero Member
  • *****
  • Posts: 2496
    • View Profile
    • NeDi
Re: cyclic DB clean up
« Reply #23 on: July 12, 2013, 07:53:09 PM »
They'll be generated nonetheless, but CPUgraphs won't show up in the GUI. This is to avoid confusion, if CPU cannot be read from a device and the value is always 0...
Please consider Other-Invoices on your NeDi installation for an annual contribution, tx!
-Remo

dobst

  • Full Member
  • ***
  • Posts: 144
    • View Profile
Re: cyclic DB clean up
« Reply #24 on: July 17, 2013, 04:46:08 PM »

rickli

  • Administrator
  • Hero Member
  • *****
  • Posts: 2496
    • View Profile
    • NeDi
Re: cyclic DB clean up
« Reply #25 on: July 17, 2013, 09:38:37 PM »
replaced extisting one in contrib for 1.0.9, tx!
Please consider Other-Invoices on your NeDi installation for an annual contribution, tx!
-Remo

tomte

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: cyclic DB clean up
« Reply #26 on: March 28, 2014, 07:47:24 AM »
Hi all,

I have a problem with the latest script.
When I execute the maintenance.sh then I have this output:

./maintenance.sh: 9: ./maintenance.sh: function: not found
./maintenance.sh: 11: ./maintenance.sh: write_output: not found
./maintenance.sh: 15: ./maintenance.sh: Syntax error: "(" unexpected (expecting ";;")

I using:
/var/www/nedi/nedi.pl version 1.0.8-321 calling Getopt::Std::getopts (version 1.06 [paranoid]),
running under Perl version 5.14.2. on Ubuntu server 12.04

Can anybody help me?

Thanks
Tomte

dobst

  • Full Member
  • ***
  • Posts: 144
    • View Profile
Re: cyclic DB clean up
« Reply #27 on: March 28, 2014, 09:20:00 AM »
Hello tompte,

which bash version are you running? I'm running

Code: [Select]
host:/ # bash --version
GNU bash, version 3.2.51(1)-release (x86_64-suse-linux-gnu)
Copyright (C) 2007 Free Software Foundation, Inc.

tomte

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: cyclic DB clean up
« Reply #28 on: March 28, 2014, 09:32:37 AM »
I using

GNU bash, Version 4.2.25(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2011 Free Software Foundation, Inc.

regards
tomte

dobst

  • Full Member
  • ***
  • Posts: 144
    • View Profile
Re: cyclic DB clean up
« Reply #29 on: March 28, 2014, 11:06:26 AM »
I think your ubuntu uses not the bash or korn shell. That's why

Code: [Select]
function some_function_name {
}
fails. I replaced the defintion with

Code: [Select]
some_function_name() {
}

Download the attached version and try to execute
Code: [Select]
bash ./maintenance.sh (non desctructive). If it works, adapt event_max_age in maintenances.sh to your needs and execute
Code: [Select]
bash ./maintenance.sh nedi.conf quick or
Code: [Select]
bash ./maintenance.sh nedi.conf intense