21 lines
924 B
PHP
21 lines
924 B
PHP
<?php
|
|
header('Content-Type: application/json');
|
|
$collections=['weval_skills'=>14000,'wevia_learnings'=>900,'wevia_kb'=>300,'wevia_memory'=>20];
|
|
$results=['ts'=>date('c'),'checks'=>[],'alerts'=>[]];
|
|
$total=0;
|
|
foreach($collections as $name=>$min){
|
|
$r=@json_decode(@file_get_contents("http://localhost:6333/collections/$name"),true);
|
|
$count=$r['result']['points_count']??0;
|
|
$total+=$count;
|
|
$ok=$count>=$min;
|
|
$results['checks'][$name]=['count'=>$count,'min'=>$min,'status'=>$ok?'OK':'ALERT'];
|
|
if(!$ok)$results['alerts'][]="$name: $count vectors (min=$min)";
|
|
}
|
|
$results['total']=$total;
|
|
$results['status']=empty($results['alerts'])?'OK':'ALERT';
|
|
if(!empty($results['alerts'])){
|
|
$msg="QDRANT ALERT: ".implode(", ",$results['alerts']);
|
|
@file_get_contents("https://api.telegram.org/bot8544624912/sendMessage?chat_id=7605775322&text=".urlencode($msg));
|
|
}
|
|
echo json_encode($results,JSON_PRETTY_PRINT);
|