45 private links
*** de cache....
ça m'a fait un sacré blackout. Faut que je trouve un moyen....
Je rebondis sur ta remarque pour dire que je trouve inacceptable ce licenciement, et encore plus si elle a été dénoncé par un/une DP.
Nous sommes là pour protéger les salariés, tous. Ce qui encore plus important dans le rôle de DP c'est de savoir écouter le salarié, dans le perso si besoin comme dans le pro sans jamais essayer de lui faire mélanger sa vie pro et perso.
Docs/howto/zabbix2 postgresql autopartitioning
Contents
1 Auto Partitioning with Zabbix 2.0 and Postgresql.
2 Create the partitions schema
3 Create the main function with the following code
4 Create a trigger for each (clock based) table you want to partition
5 Disable partitioning
6 Remove unwanted old partitions
Auto Partitioning with Zabbix 2.0 and Postgresql.
Here is my take on Zabbix and Postgresql 9.x (auto) partitioning.
This approach:
does not require you to prepare the database to partition it with zabbix
does not require you to create/schedule a cron job for creating the tables in advance
seems a bit simpler to implement than other solutions.
It will auto create partitions under the "partition" schema with the following name convention
partitions.tablename_pYYYYMMDD # for DAILY partitions
partitions.tablename_pYYYYMM # for MONTHLY partitions
Create the partitions schema
The partitioned tables will be created under the "partitions" schema, which you can create with:
-- Schema: partitions
-- DROP SCHEMA partitions;
CREATE SCHEMA partitions
AUTHORIZATION zabbix;
Grant authorization to the PostgreSQL account used by Zabbix. See DBUser in zabbix_server.conf.
Create the main function with the following code
-- Function: trg_partition()
-- DROP FUNCTION trg_partition();
CREATE OR REPLACE FUNCTION trg_partition()
RETURNS trigger AS
$BODY$
DECLARE
prefix text := 'partitions.';
timeformat text;
selector text;
_interval interval;
tablename text;
startdate text;
enddate text;
create_table_part text;
create_index_part text;
BEGIN
selector = TG_ARGV[0];
IF selector = 'day' THEN
timeformat := 'YYYY_MM_DD';
ELSIF selector = 'month' THEN
timeformat := 'YYYY_MM';
END IF;
_interval := '1 ' || selector;
tablename := TG_TABLE_NAME || '_p' || to_char(to_timestamp(NEW.clock), timeformat);
EXECUTE 'INSERT INTO ' || prefix || quote_ident(tablename) || ' SELECT ($1).*' USING NEW;
RETURN NULL;
EXCEPTION
WHEN undefined_table THEN
startdate := extract(epoch FROM date_trunc(selector, to_timestamp(NEW.clock)));
enddate := extract(epoch FROM date_trunc(selector, to_timestamp(NEW.clock) + _interval ));
create_table_part:= 'CREATE TABLE IF NOT EXISTS '|| prefix || quote_ident(tablename) || ' (CHECK ((clock >= ' || quote_literal(startdate) || ' AND clock < ' || quote_literal(enddate) || '))) INHERITS ('|| TG_TABLE_NAME || ')';
create_index_part:= 'CREATE INDEX '|| quote_ident(tablename) || '_1 on ' || prefix || quote_ident(tablename) || '(itemid,clock)';
EXECUTE create_table_part;
EXECUTE create_index_part;
--insert it again
EXECUTE 'INSERT INTO ' || prefix || quote_ident(tablename) || ' SELECT ($1).*' USING NEW;
RETURN NULL;
END;
$BODY$
LANGUAGE plpgsql VOLATILE
COST 100;
ALTER FUNCTION trg_partition()
OWNER TO postgres;
Create a trigger for each (clock based) table you want to partition
CREATE TRIGGER partition_trg BEFORE INSERT ON history FOR EACH ROW EXECUTE PROCEDURE trg_partition('day');
CREATE TRIGGER partition_trg BEFORE INSERT ON history_uint FOR EACH ROW EXECUTE PROCEDURE trg_partition('day');
CREATE TRIGGER partition_trg BEFORE INSERT ON history_str FOR EACH ROW EXECUTE PROCEDURE trg_partition('day');
CREATE TRIGGER partition_trg BEFORE INSERT ON history_text FOR EACH ROW EXECUTE PROCEDURE trg_partition('day');
CREATE TRIGGER partition_trg BEFORE INSERT ON history_log FOR EACH ROW EXECUTE PROCEDURE trg_partition('day');
CREATE TRIGGER partition_trg BEFORE INSERT ON trends FOR EACH ROW EXECUTE PROCEDURE trg_partition('month');
CREATE TRIGGER partition_trg BEFORE INSERT ON trends_uint FOR EACH ROW EXECUTE PROCEDURE trg_partition('month');
Disable partitioning
Should you want to remove the partitioning, just remove the partition_trg from each table, or run the following
DROP TRIGGER partition_trg ON history;
DROP TRIGGER partition_trg ON history_uint;
DROP TRIGGER partition_trg ON history_str;
DROP TRIGGER partition_trg ON history_text;
DROP TRIGGER partition_trg ON history_log;
DROP TRIGGER partition_trg ON trends;
DROP TRIGGER partition_trg ON trends_uint;
Remove unwanted old partitions
The following optional routine is to delete partitions older than the desired time. Unfortunately it requires you to schedule it using "cron" or run it manually. (SEE BELOW)
-- Function: delete_partitions(interval, text)
-- DROP FUNCTION delete_partitions(interval, text);
CREATE OR REPLACE FUNCTION delete_partitions(intervaltodelete interval, tabletype text)
RETURNS text AS
$BODY$
DECLARE
result record ;
prefix text := 'partitions.';
table_timestamp timestamp;
delete_before_date date;
tablename text;
BEGIN
FOR result IN SELECT * FROM pg_tables WHERE schemaname = 'partitions' LOOP
table_timestamp := to_timestamp(substring(result.tablename from '[0-9_]*$'), 'YYYY_MM_DD');
delete_before_date := date_trunc('day', NOW() - intervalToDelete);
tablename := result.tablename;
-- Was it called properly?
IF tabletype != 'month' AND tabletype != 'day' THEN
RAISE EXCEPTION 'Please specify "month" or "day" instead of %', tabletype;
END IF;
--Check whether the table name has a day (YYYY_MM_DD) or month (YYYY_MM) format
IF length(substring(result.tablename from '[0-9_]*$')) = 10 AND tabletype = 'month' THEN
--This is a daily partition YYYY_MM_DD
-- RAISE NOTICE 'Skipping table % when trying to delete "%" partitions (%)', result.tablename, tabletype, length(substring(result.tablename from '[0-9_]*$'));
CONTINUE;
ELSIF length(substring(result.tablename from '[0-9_]*$')) = 7 AND tabletype = 'day' THEN
--this is a monthly partition
--RAISE NOTICE 'Skipping table % when trying to delete "%" partitions (%)', result.tablename, tabletype, length(substring(result.tablename from '[0-9_]*$'));
CONTINUE;
ELSE
--This is the correct table type. Go ahead and check if it needs to be deleted
--RAISE NOTICE 'Checking table %', result.tablename;
END IF;
IF table_timestamp <= delete_before_date THEN
RAISE NOTICE 'Deleting table %', quote_ident(tablename);
EXECUTE 'DROP TABLE ' || prefix || quote_ident(tablename) || ';';
END IF;
END LOOP;
RETURN 'OK';
END;
$BODY$
LANGUAGE plpgsql VOLATILE
COST 100;
ALTER FUNCTION delete_partitions(interval, text)
OWNER TO postgres;
You can then remove old partition using the following commands
SELECT delete_partitions('7 days', 'day')
SELECT delete_partitions('11 months', 'month')
EDIT : ma correction pour éviter un max_lock_per_transaction quand il y a beaucoup de tables :
-- Function: delete_partitions(interval, text)
-- DROP FUNCTION delete_partitions(interval, text);
CREATE OR REPLACE FUNCTION delete_partitions(intervaltodelete interval, tabletype text)
RETURNS text AS
$BODY$
DECLARE
result record ;
prefix text := 'partitions.';
table_timestamp timestamp;
delete_before_date date;
tablename text;
maxtable integer :=25;
deletedtable integer :=0;
BEGIN
delete_before_date := date_trunc('day', NOW() - intervalToDelete);
RAISE NOTICE 'Deleting table before %', delete_before_date;
FOR result IN SELECT * FROM pg_tables WHERE schemaname = 'partitions' LOOP
table_timestamp := to_timestamp(substring(result.tablename from '[0-9_]*$'), 'YYYY_MM_DD');
tablename := result.tablename;
-- Was it called properly?
IF tabletype != 'month' AND tabletype != 'day' THEN
RAISE EXCEPTION 'Please specify "month" or "day" instead of %', tabletype;
END IF;
--Check whether the table name has a day (YYYY_MM_DD) or month (YYYY_MM) format
IF length(substring(result.tablename from '[0-9_]*$')) = 10 AND tabletype = 'month' THEN
--This is a daily partition YYYY_MM_DD
-- RAISE NOTICE 'Skipping table % when trying to delete "%" partitions (%)', result.tablename, tabletype, length(substring(result.tablename from '[0-9_]*$'));
CONTINUE;
ELSIF length(substring(result.tablename from '[0-9_]*$')) = 7 AND tabletype = 'day' THEN
--this is a monthly partition
--RAISE NOTICE 'Skipping table % when trying to delete "%" partitions (%)', result.tablename, tabletype, length(substring(result.tablename from '[0-9_]*$'));
CONTINUE;
ELSE
--This is the correct table type. Go ahead and check if it needs to be deleted
--RAISE NOTICE 'Checking table %', result.tablename;
END IF;
EXIT WHEN deletedtable >= maxtable;
IF table_timestamp <= delete_before_date THEN
RAISE NOTICE 'Deleting table %', quote_ident(tablename);
EXECUTE 'DROP TABLE ' || prefix || quote_ident(tablename) || ';';
deletedtable := deletedtable+1;
END IF;
END LOOP;
RETURN 'OK';
END;
$BODY$
LANGUAGE plpgsql VOLATILE
COST 100;
ALTER FUNCTION delete_partitions(interval, text)
OWNER TO postgres;
SELECT nspname || '.' || relname AS "relation",
pg_size_pretty(pg_relation_size(C.oid)) AS "size"
FROM pg_class C
LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace)
WHERE nspname NOT IN ('pg_catalog', 'information_schema')
ORDER BY pg_relation_size(C.oid) DESC
LIMIT 20;
ça marche top (testé sur debian + ubuntu et actuellement en prod). ça reload les services, le réseau, etc mais pas le hardware.
ça ressemble à un soft reboot chez android.
apt-get install kexec-tools
systemctl kexec
uname -r
coldreboot pour un vrai redémarrage
Pour ceux qui ne savent plus quoi faire de leurs BC ;-)
Je crois que je vais aller sur un moto g5 plus :
Environ 5"
Lineageos compatible
Batterie changeable
NFC + 700mhz
Bon appareil photo et bonne autonomie.
Pour 250€ environ.
J'attends les soldes.
J'attends le moto g5 plus à moins de 220€, il serait pas mal à tous niveaux.
Compatible lineageos en plus
Même chose de mon côté !
Ça le ferait de se croiser. Mais les distances n'aident pas toujours.
Très très bon.
topo dell sur les failles CPU
apt-get install --only-upgrade <packagename>
Software Used by Hayao Miyazaki’s Animation Studio Becomes Open Source & Free to Download https://t.co/JDPRdq1Xfg https://t.co/9DjUr440K1
TIL: Visualize your PostgreSQL database schema with 3 commands:
$ sudo apt-get install graphviz postgresql-autodoc
$ postgresql_autodoc -t dot -d yourdatabasename
$ dot -Tpng https://t.co/5EDEoYMkWV -o schema.png
Question
Sign in to vote
5
Sign in to vote
I found a way to default the domain:
Browse to:
C:\Program Files\Microsoft\Exchange Server\V15\FrontEnd\HttpProxy\owa\auth\<latestversion>\scripts\premium\
Make a backup copy of fexppw.js, then look for this section:
// UPN authentication isn't supported, don't fill in the username
// if it's an email address
//
if (rg && rg[3].indexOf('@') == -1)
{
// Fill in username, set focus to password
//
gbid("username").value = rg[3];
gbid("oldPwd").focus();
}
Change the username value setting code to this:
gbid("username").value = "YOURDOMAIN\" + rg[3];
Arnaud ouvre sa page web. Il croit à un problème de connexion, calmement il rallume sa box. L'heure s'affiche à nouveau mais son internet est cassé : les f5 n'y font rien. Arnaud veut appeler Nico, son vieil ami informaticien, hélas, cela fait longtemps qu'il n'a plus son numéro, leurs conversations étaient tellement plus simples derrière un écran. Arnaud ne sait plus quoi faire, c'est la déprime : son 6m2 ne lui permet pas de bouger tellement ses affaires sont empilées. Ses affaires, ils ne les a pas touché depuis 4 ans, à l'époque il venait d'emménager, sa connexion avait été activée bien avant de penser à déballer les carton. Aujourd'hui, Arnaud ouvre le petit carton beige devant lui, une paire de chaussures de volley, un ballon, un jeu de carte. Aujourd'hui Google ne fonctionnera plus. Internet est cassé #mercredifiction
Coudé. #parcecitya
<3
Je crois que ploum a fait plaf....