Add French docstrings and README
- Docstrings for all modules, classes and methods - README.md with installation and usage instructions - Update CLAUDE.md with dns.py Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
"""
|
||||
Checker Ping.
|
||||
|
||||
Vérifie la disponibilité d'un hôte via ICMP ping.
|
||||
"""
|
||||
|
||||
import subprocess
|
||||
import time
|
||||
import platform
|
||||
@@ -6,12 +12,30 @@ from .base import BaseChecker, CheckResult
|
||||
|
||||
|
||||
class PingChecker(BaseChecker):
|
||||
"""
|
||||
Vérifie la disponibilité d'un hôte via ping ICMP.
|
||||
|
||||
Configuration YAML:
|
||||
host: Adresse IP ou nom d'hôte à vérifier (obligatoire).
|
||||
count: Nombre de paquets à envoyer (défaut: 1).
|
||||
timeout: Délai d'attente en secondes (défaut: 5).
|
||||
"""
|
||||
|
||||
def check(self) -> CheckResult:
|
||||
"""
|
||||
Exécute un ping vers l'hôte configuré.
|
||||
|
||||
Adapte automatiquement la commande ping selon le système
|
||||
d'exploitation (Windows ou Linux/macOS).
|
||||
|
||||
Returns:
|
||||
CheckResult avec success=True si l'hôte répond.
|
||||
"""
|
||||
host = self.config["host"]
|
||||
count = self.config.get("count", 1)
|
||||
timeout = self.config.get("timeout", 5)
|
||||
|
||||
# Adapt ping command for OS
|
||||
# Adapte la commande ping selon l'OS
|
||||
if platform.system().lower() == "windows":
|
||||
cmd = ["ping", "-n", str(count), "-w", str(timeout * 1000), host]
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user