first commit

This commit is contained in:
Xavier Rodriguez
2025-12-09 12:45:15 +01:00
commit 7fc616b5c3
44 changed files with 6981 additions and 0 deletions
+49
View File
@@ -0,0 +1,49 @@
#!/bin/bash
# Script de ejemplo para usar el nuevo servicio HTTPS con POST
# ============================================================
# Configuración
SERVER_URL="https://localhost:8443"
HOST="10.150.226.29"
USERNAME="itops"
PASSWORD='Tr4!D0r3s'
echo "🔒 Cisco MAC Monitor - Ejemplo HTTPS POST"
echo "=========================================="
# Test 1: Health check
echo "1. Testing health check..."
curl -k -s "${SERVER_URL}/health" | python3 -m json.tool
echo -e "\n"
# Test 2: Métricas
echo "2. Testing metrics..."
curl -k -s "${SERVER_URL}/metrics" | python3 -m json.tool
echo -e "\n"
# Test 3: Monitorización MAC con POST seguro
echo "3. Testing MAC monitoring (POST seguro)..."
# Crear JSON payload
JSON_PAYLOAD=$(cat <<EOF
{
"host": "${HOST}",
"username": "${USERNAME}",
"password": "${PASSWORD}",
"hostname": "SW-CORE-${HOST}",
"timeout": 30
}
EOF
)
echo "JSON Payload enviado:"
echo "${JSON_PAYLOAD}" | python3 -m json.tool
echo -e "\nRespuesta del servidor:"
curl -k -s -X POST "${SERVER_URL}/mac-monitor" \
-H "Content-Type: application/json" \
-d "${JSON_PAYLOAD}" | python3 -m json.tool
echo -e "\n✅ Test completado!"