http://naiggy.blogspot.com/2017/03/zabbix-housekeeper_23.html
을 참조해 주십시요.
수동실행은
저의 경우는 60일 이전의 데이터는 삭제 하라는 스크립트 입니다.
60이라고 쓰여진 곳을 수정하여 원하시는 숫자를 넣어 주십시요.
Mysql
delete from history where clock < UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 60 day));delete from history_str where clock < UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 60 day));
delete from history_log where clock < UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 60 day));
delete from history_uint where clock < UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 60 day));
delete from history_text where clock < UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 60 day));
delete from trends where clock < UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 60 day));
delete from trends_uint where clock < UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 60 day));
delete from service_alarms where clock < UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 60 day));
delete from auditlog where clock < UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 60 day));
delete from events where clock < UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 60 day));
delete from sessions where lastaccess < UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 60 day));
PostgreSQL
delete from history where clock < extract('epoch' from current_timestamp - interval'60 days') ;delete from history_str where clock < extract('epoch' from current_timestamp - interval'60 days') ;
delete from history_log where clock < extract('epoch' from current_timestamp - interval'60 days') ;
delete from history_uint where clock < extract('epoch' from current_timestamp - interval'60 days') ;
delete from history_text where clock < extract('epoch' from current_timestamp - interval'60 days') ;
delete from trends where clock < extract('epoch' from current_timestamp - interval'60 days') ;
delete from trends_uint where clock < extract('epoch' from current_timestamp - interval'60 days') ;
delete from service_alarms where clock < extract('epoch' from current_timestamp - interval'60 days') ;
delete from auditlog where clock < extract('epoch' from current_timestamp - interval'60 days') ;
delete from events where clock < extract('epoch' from current_timestamp - interval'60 days') ;
delete from sessions where lastaccess < extract('epoch' from current_timestamp - interval'60 days') ;
0 件のコメント:
コメントを投稿