# Comprender el estado “sobrecargado” y cómo diagnosticarlo

En la búsqueda de repetidores mostramos un punto ámbar al lado del sobrenombre del repetidor cuando este está sobrecargado. Esto significa que una o muchas de las siguientes métricas de carga han sido desencadenadas:

- Cualquier invocación OOM de Tor debida a presiones en la memoria
- Cualesquiera onionskins de ntor son descartadas
- Agotamiento de puertos TCP

Ten en cuenta que si un repetidor alcanza un estado de sobrecarga lo mostramos por 72 horas luego de que el repetidor se haya resuperado.

Si notas que tu repetidor está sobrecargado, por favor:

1. Busca en https://status.torproject.org/ problemas en la categoría "red Tor".
2. Considera sintonizar `sysctl` para tu sistema para las cargas de red, memoria y CPU.
3. Considera habilitar `MetricsPort` para entender qué está pasando.

## Sintonizando `sysctl` para cargas de red, memoria y CPU

### Agotamiento de puertos TCP

Si estás experimentando agotamiento de puertos TCP considera expandir tu rango de puertos locales. Puedes hacer eso con

`# sysctl -w net.ipv4.ip_local_port_range="15000 64000"`

o

`# echo 15000 64000 > /proc/sys/net/ipv4/ip_local_port_range`

Ten en cuenta que ajustar el `sysctl` como se indica no es permanente y el cambio se perderá en el siguiente reinicio. Necesitas añadir la configuración a `/etc/sysctl.conf` o a un archivo en `/etc/sysctl.d/` para que los ajustes sean permanentes.

## MetricsPort

Para asegurarse del buen funcionamiento de los repetidores Tor y de la red Tor en general es primordial proporcionar y tener acceso a las mediciones de los repetidores. La información de sobrecarga de los repetidores ha sido incluida en los descriptores desde las versiones posteriores a la 0.4.6, pero no fue hasta la publicación de la versión 0.4.7.1-alpha y posteriores que estuvo disponible una interfaz de las mediciones de los repetidores: metrics port.

### Activar MetricsPort

Tor proporciona acceso al puerto de mediciones mediante una opción de configuración en torrc llamada `MetricsPort`.

Es importante entender que exponer públicamente el puerto de mediciones es peligroso para los usuarios de la red Tor, por lo que por omisión no está activado y el acceso debe de permitirse explicitamente por medio de una política de acceso. Por favor, toma precaución y cuidado extras al abrir este puerto, y ciérralo cuando hayas finalizado la depuración de errores.

Vamos a asumir que tú eres el único usuario en un servidor que tiene funcionando un repetidor Tor. Puedes activar el puerto de mediciones añadiendo esto al archivo torrc:

    MetricsPort 127.0.0.1:9035
    MetricsPortPolicy accept 127.0.0.1

Entonces podras descargar las mediciones fácilmente con:

`# curl http://127.0.0.1:9035/metrics`

que de forma predeterminada están en el formato Prometheus.

Nota: cada usuario del servidor será capaz de acceder a esas mediciones del repetidor del ejemplo anterior. En general, establece una política de acceso muy estricta con `MetricsPortPolicy` y considera usar las características del cortafuegos de tu sistema operativo para una defensa en profundidad.

Para una explicación más detallada de `MetricsPort` y `MetricsPortPolicy` consulta la página man de tor.

### Formato de los informes de MetricsPort

He aquí un ejemplo del tipo de salida que genera el activar `MetricsPort` (hemos omitido las métricas relacionadas con el control de la congestión debido a que todavía necesitamos estabilizar la interfaz):

    # HELP tor_relay_connections Total number of opened connections
    # TYPE tor_relay_connections gauge
    tor_relay_connections{type="OR listener",direction="initiated",state="opened",family="ipv4"} 0
    tor_relay_connections{type="OR listener",direction="initiated",state="opened",family="ipv6"} 0
    tor_relay_connections{type="OR listener",direction="received",state="opened",family="ipv4"} 0
    tor_relay_connections{type="OR listener",direction="received",state="opened",family="ipv6"} 0
    tor_relay_connections{type="OR",direction="initiated",state="opened",family="ipv4"} 0
    tor_relay_connections{type="OR",direction="initiated",state="opened",family="ipv6"} 0
    tor_relay_connections{type="OR",direction="received",state="opened",family="ipv4"} 0
    tor_relay_connections{type="OR",direction="received",state="opened",family="ipv6"} 0
    tor_relay_connections{type="Exit",direction="initiated",state="opened",family="ipv4"} 0
    tor_relay_connections{type="Exit",direction="initiated",state="opened",family="ipv6"} 0
    tor_relay_connections{type="Exit",direction="received",state="opened",family="ipv4"} 0
    tor_relay_connections{type="Exit",direction="received",state="opened",family="ipv6"} 0
    tor_relay_connections{type="Socks listener",direction="initiated",state="opened",family="ipv4"} 0
    tor_relay_connections{type="Socks listener",direction="initiated",state="opened",family="ipv6"} 0
    tor_relay_connections{type="Socks listener",direction="received",state="opened",family="ipv4"} 0
    tor_relay_connections{type="Socks listener",direction="received",state="opened",family="ipv6"} 0
    tor_relay_connections{type="Socks",direction="initiated",state="opened",family="ipv4"} 0
    tor_relay_connections{type="Socks",direction="initiated",state="opened",family="ipv6"} 0
    tor_relay_connections{type="Socks",direction="received",state="opened",family="ipv4"} 0
    tor_relay_connections{type="Socks",direction="received",state="opened",family="ipv6"} 0
    tor_relay_connections{type="Directory listener",direction="initiated",state="opened",family="ipv4"} 0
    tor_relay_connections{type="Directory listener",direction="initiated",state="opened",family="ipv6"} 0
    tor_relay_connections{type="Directory listener",direction="received",state="opened",family="ipv4"} 0
    tor_relay_connections{type="Directory listener",direction="received",state="opened",family="ipv6"} 0
    tor_relay_connections{type="Directory",direction="initiated",state="opened",family="ipv4"} 0
    tor_relay_connections{type="Directory",direction="initiated",state="opened",family="ipv6"} 0
    tor_relay_connections{type="Directory",direction="received",state="opened",family="ipv4"} 0
    tor_relay_connections{type="Directory",direction="received",state="opened",family="ipv6"} 0
    tor_relay_connections{type="Control listener",direction="initiated",state="opened",family="ipv4"} 0
    tor_relay_connections{type="Control listener",direction="initiated",state="opened",family="ipv6"} 0
    tor_relay_connections{type="Control listener",direction="received",state="opened",family="ipv4"} 0
    tor_relay_connections{type="Control listener",direction="received",state="opened",family="ipv6"} 0
    tor_relay_connections{type="Control",direction="initiated",state="opened",family="ipv4"} 0
    tor_relay_connections{type="Control",direction="initiated",state="opened",family="ipv6"} 0
    tor_relay_connections{type="Control",direction="received",state="opened",family="ipv4"} 0
    tor_relay_connections{type="Control",direction="received",state="opened",family="ipv6"} 0
    tor_relay_connections{type="Transparent pf/netfilter listener",direction="initiated",state="opened",family="ipv4"} 0
    tor_relay_connections{type="Transparent pf/netfilter listener",direction="initiated",state="opened",family="ipv6"} 0
    tor_relay_connections{type="Transparent pf/netfilter listener",direction="received",state="opened",family="ipv4"} 0
    tor_relay_connections{type="Transparent pf/netfilter listener",direction="received",state="opened",family="ipv6"} 0
    tor_relay_connections{type="Transparent natd listener",direction="initiated",state="opened",family="ipv4"} 0
    tor_relay_connections{type="Transparent natd listener",direction="initiated",state="opened",family="ipv6"} 0
    tor_relay_connections{type="Transparent natd listener",direction="received",state="opened",family="ipv4"} 0
    tor_relay_connections{type="Transparent natd listener",direction="received",state="opened",family="ipv6"} 0
    tor_relay_connections{type="DNS listener",direction="initiated",state="opened",family="ipv4"} 0
    tor_relay_connections{type="DNS listener",direction="initiated",state="opened",family="ipv6"} 0
    tor_relay_connections{type="DNS listener",direction="received",state="opened",family="ipv4"} 0
    tor_relay_connections{type="DNS listener",direction="received",state="opened",family="ipv6"} 0
    tor_relay_connections{type="Extended OR",direction="initiated",state="opened",family="ipv4"} 0
    tor_relay_connections{type="Extended OR",direction="initiated",state="opened",family="ipv6"} 0
    tor_relay_connections{type="Extended OR",direction="received",state="opened",family="ipv4"} 0
    tor_relay_connections{type="Extended OR",direction="received",state="opened",family="ipv6"} 0
    tor_relay_connections{type="Extended OR listener",direction="initiated",state="opened",family="ipv4"} 0
    tor_relay_connections{type="Extended OR listener",direction="initiated",state="opened",family="ipv6"} 0
    tor_relay_connections{type="Extended OR listener",direction="received",state="opened",family="ipv4"} 0
    tor_relay_connections{type="Extended OR listener",direction="received",state="opened",family="ipv6"} 0
    tor_relay_connections{type="HTTP tunnel listener",direction="initiated",state="opened",family="ipv4"} 0
    tor_relay_connections{type="HTTP tunnel listener",direction="initiated",state="opened",family="ipv6"} 0
    tor_relay_connections{type="HTTP tunnel listener",direction="received",state="opened",family="ipv4"} 0
    tor_relay_connections{type="HTTP tunnel listener",direction="received",state="opened",family="ipv6"} 0
    tor_relay_connections{type="Metrics listener",direction="initiated",state="opened",family="ipv4"} 0
    tor_relay_connections{type="Metrics listener",direction="initiated",state="opened",family="ipv6"} 0
    tor_relay_connections{type="Metrics listener",direction="received",state="opened",family="ipv4"} 0
    tor_relay_connections{type="Metrics listener",direction="received",state="opened",family="ipv6"} 0
    tor_relay_connections{type="Metrics",direction="initiated",state="opened",family="ipv4"} 0
    tor_relay_connections{type="Metrics",direction="initiated",state="opened",family="ipv6"} 0
    tor_relay_connections{type="Metrics",direction="received",state="opened",family="ipv4"} 0
    tor_relay_connections{type="Metrics",direction="received",state="opened",family="ipv6"} 0
    # HELP tor_relay_connections_total Total number of created/rejected connections
    # TYPE tor_relay_connections_total counter
    tor_relay_connections_total{type="OR listener",direction="initiated",state="created",family="ipv4"} 0
    tor_relay_connections_total{type="OR listener",direction="initiated",state="created",family="ipv6"} 0
    tor_relay_connections_total{type="OR listener",direction="received",state="created",family="ipv4"} 0
    tor_relay_connections_total{type="OR listener",direction="received",state="created",family="ipv6"} 0
    tor_relay_connections_total{type="OR listener",direction="received",state="rejected",family="ipv4"} 0
    tor_relay_connections_total{type="OR listener",direction="received",state="rejected",family="ipv6"} 0
    tor_relay_connections_total{type="OR",direction="initiated",state="created",family="ipv4"} 0
    tor_relay_connections_total{type="OR",direction="initiated",state="created",family="ipv6"} 0
    tor_relay_connections_total{type="OR",direction="received",state="created",family="ipv4"} 0
    tor_relay_connections_total{type="OR",direction="received",state="created",family="ipv6"} 0
    tor_relay_connections_total{type="OR",direction="received",state="rejected",family="ipv4"} 0
    tor_relay_connections_total{type="OR",direction="received",state="rejected",family="ipv6"} 0
    tor_relay_connections_total{type="Exit",direction="initiated",state="created",family="ipv4"} 0
    tor_relay_connections_total{type="Exit",direction="initiated",state="created",family="ipv6"} 0
    tor_relay_connections_total{type="Exit",direction="received",state="created",family="ipv4"} 0
    tor_relay_connections_total{type="Exit",direction="received",state="created",family="ipv6"} 0
    tor_relay_connections_total{type="Exit",direction="received",state="rejected",family="ipv4"} 0
    tor_relay_connections_total{type="Exit",direction="received",state="rejected",family="ipv6"} 0
    tor_relay_connections_total{type="Socks listener",direction="initiated",state="created",family="ipv4"} 0
    tor_relay_connections_total{type="Socks listener",direction="initiated",state="created",family="ipv6"} 0
    tor_relay_connections_total{type="Socks listener",direction="received",state="created",family="ipv4"} 0
    tor_relay_connections_total{type="Socks listener",direction="received",state="created",family="ipv6"} 0
    tor_relay_connections_total{type="Socks listener",direction="received",state="rejected",family="ipv4"} 0
    tor_relay_connections_total{type="Socks listener",direction="received",state="rejected",family="ipv6"} 0
    tor_relay_connections_total{type="Socks",direction="initiated",state="created",family="ipv4"} 0
    tor_relay_connections_total{type="Socks",direction="initiated",state="created",family="ipv6"} 0
    tor_relay_connections_total{type="Socks",direction="received",state="created",family="ipv4"} 0
    tor_relay_connections_total{type="Socks",direction="received",state="created",family="ipv6"} 0
    tor_relay_connections_total{type="Socks",direction="received",state="rejected",family="ipv4"} 0
    tor_relay_connections_total{type="Socks",direction="received",state="rejected",family="ipv6"} 0
    tor_relay_connections_total{type="Directory listener",direction="initiated",state="created",family="ipv4"} 0
    tor_relay_connections_total{type="Directory listener",direction="initiated",state="created",family="ipv6"} 0
    tor_relay_connections_total{type="Directory listener",direction="received",state="created",family="ipv4"} 0
    tor_relay_connections_total{type="Directory listener",direction="received",state="created",family="ipv6"} 0
    tor_relay_connections_total{type="Directory listener",direction="received",state="rejected",family="ipv4"} 0
    tor_relay_connections_total{type="Directory listener",direction="received",state="rejected",family="ipv6"} 0
    tor_relay_connections_total{type="Directory",direction="initiated",state="created",family="ipv4"} 0
    tor_relay_connections_total{type="Directory",direction="initiated",state="created",family="ipv6"} 0
    tor_relay_connections_total{type="Directory",direction="received",state="created",family="ipv4"} 0
    tor_relay_connections_total{type="Directory",direction="received",state="created",family="ipv6"} 0
    tor_relay_connections_total{type="Directory",direction="received",state="rejected",family="ipv4"} 0
    tor_relay_connections_total{type="Directory",direction="received",state="rejected",family="ipv6"} 0
    tor_relay_connections_total{type="Control listener",direction="initiated",state="created",family="ipv4"} 0
    tor_relay_connections_total{type="Control listener",direction="initiated",state="created",family="ipv6"} 0
    tor_relay_connections_total{type="Control listener",direction="received",state="created",family="ipv4"} 0
    tor_relay_connections_total{type="Control listener",direction="received",state="created",family="ipv6"} 0
    tor_relay_connections_total{type="Control listener",direction="received",state="rejected",family="ipv4"} 0
    tor_relay_connections_total{type="Control listener",direction="received",state="rejected",family="ipv6"} 0
    tor_relay_connections_total{type="Control",direction="initiated",state="created",family="ipv4"} 0
    tor_relay_connections_total{type="Control",direction="initiated",state="created",family="ipv6"} 0
    tor_relay_connections_total{type="Control",direction="received",state="created",family="ipv4"} 0
    tor_relay_connections_total{type="Control",direction="received",state="created",family="ipv6"} 0
    tor_relay_connections_total{type="Control",direction="received",state="rejected",family="ipv4"} 0
    tor_relay_connections_total{type="Control",direction="received",state="rejected",family="ipv6"} 0
    tor_relay_connections_total{type="Transparent pf/netfilter listener",direction="initiated",state="created",family="ipv4"} 0
    tor_relay_connections_total{type="Transparent pf/netfilter listener",direction="initiated",state="created",family="ipv6"} 0
    tor_relay_connections_total{type="Transparent pf/netfilter listener",direction="received",state="created",family="ipv4"} 0
    tor_relay_connections_total{type="Transparent pf/netfilter listener",direction="received",state="created",family="ipv6"} 0
    tor_relay_connections_total{type="Transparent pf/netfilter listener",direction="received",state="rejected",family="ipv4"} 0
    tor_relay_connections_total{type="Transparent pf/netfilter listener",direction="received",state="rejected",family="ipv6"} 0
    tor_relay_connections_total{type="Transparent natd listener",direction="initiated",state="created",family="ipv4"} 0
    tor_relay_connections_total{type="Transparent natd listener",direction="initiated",state="created",family="ipv6"} 0
    tor_relay_connections_total{type="Transparent natd listener",direction="received",state="created",family="ipv4"} 0
    tor_relay_connections_total{type="Transparent natd listener",direction="received",state="created",family="ipv6"} 0
    tor_relay_connections_total{type="Transparent natd listener",direction="received",state="rejected",family="ipv4"} 0
    tor_relay_connections_total{type="Transparent natd listener",direction="received",state="rejected",family="ipv6"} 0
    tor_relay_connections_total{type="DNS listener",direction="initiated",state="created",family="ipv4"} 0
    tor_relay_connections_total{type="DNS listener",direction="initiated",state="created",family="ipv6"} 0
    tor_relay_connections_total{type="DNS listener",direction="received",state="created",family="ipv4"} 0
    tor_relay_connections_total{type="DNS listener",direction="received",state="created",family="ipv6"} 0
    tor_relay_connections_total{type="DNS listener",direction="received",state="rejected",family="ipv4"} 0
    tor_relay_connections_total{type="DNS listener",direction="received",state="rejected",family="ipv6"} 0
    tor_relay_connections_total{type="Extended OR",direction="initiated",state="created",family="ipv4"} 0
    tor_relay_connections_total{type="Extended OR",direction="initiated",state="created",family="ipv6"} 0
    tor_relay_connections_total{type="Extended OR",direction="received",state="created",family="ipv4"} 0
    tor_relay_connections_total{type="Extended OR",direction="received",state="created",family="ipv6"} 0
    tor_relay_connections_total{type="Extended OR",direction="received",state="rejected",family="ipv4"} 0
    tor_relay_connections_total{type="Extended OR",direction="received",state="rejected",family="ipv6"} 0
    tor_relay_connections_total{type="Extended OR listener",direction="initiated",state="created",family="ipv4"} 0
    tor_relay_connections_total{type="Extended OR listener",direction="initiated",state="created",family="ipv6"} 0
    tor_relay_connections_total{type="Extended OR listener",direction="received",state="created",family="ipv4"} 0
    tor_relay_connections_total{type="Extended OR listener",direction="received",state="created",family="ipv6"} 0
    tor_relay_connections_total{type="Extended OR listener",direction="received",state="rejected",family="ipv4"} 0
    tor_relay_connections_total{type="Extended OR listener",direction="received",state="rejected",family="ipv6"} 0
    tor_relay_connections_total{type="HTTP tunnel listener",direction="initiated",state="created",family="ipv4"} 0
    tor_relay_connections_total{type="HTTP tunnel listener",direction="initiated",state="created",family="ipv6"} 0
    tor_relay_connections_total{type="HTTP tunnel listener",direction="received",state="created",family="ipv4"} 0
    tor_relay_connections_total{type="HTTP tunnel listener",direction="received",state="created",family="ipv6"} 0
    tor_relay_connections_total{type="HTTP tunnel listener",direction="received",state="rejected",family="ipv4"} 0
    tor_relay_connections_total{type="HTTP tunnel listener",direction="received",state="rejected",family="ipv6"} 0
    tor_relay_connections_total{type="Metrics listener",direction="initiated",state="created",family="ipv4"} 0
    tor_relay_connections_total{type="Metrics listener",direction="initiated",state="created",family="ipv6"} 0
    tor_relay_connections_total{type="Metrics listener",direction="received",state="created",family="ipv4"} 0
    tor_relay_connections_total{type="Metrics listener",direction="received",state="created",family="ipv6"} 0
    tor_relay_connections_total{type="Metrics listener",direction="received",state="rejected",family="ipv4"} 0
    tor_relay_connections_total{type="Metrics listener",direction="received",state="rejected",family="ipv6"} 0
    tor_relay_connections_total{type="Metrics",direction="initiated",state="created",family="ipv4"} 0
    tor_relay_connections_total{type="Metrics",direction="initiated",state="created",family="ipv6"} 0
    tor_relay_connections_total{type="Metrics",direction="received",state="created",family="ipv4"} 0
    tor_relay_connections_total{type="Metrics",direction="received",state="created",family="ipv6"} 0
    tor_relay_connections_total{type="Metrics",direction="received",state="rejected",family="ipv4"} 0
    tor_relay_connections_total{type="Metrics",direction="received",state="rejected",family="ipv6"} 0
    # HELP tor_relay_flag Relay flags from consensus
    # TYPE tor_relay_flag gauge
    tor_relay_flag{type="Fast"} 0
    tor_relay_flag{type="Exit"} 0
    tor_relay_flag{type="Authority"} 0
    tor_relay_flag{type="Stable"} 0
    tor_relay_flag{type="HSDir"} 0
    tor_relay_flag{type="Running"} 0
    tor_relay_flag{type="V2Dir"} 0
    tor_relay_flag{type="Sybil"} 0
    tor_relay_flag{type="Guard"} 0
    # HELP tor_relay_circuits_total Total number of circuits
    # TYPE tor_relay_circuits_total gauge
    tor_relay_circuits_total{state="opened"} 0
    # HELP tor_relay_streams_total Total number of streams
    # TYPE tor_relay_streams_total counter
    tor_relay_streams_total{type="BEGIN"} 0
    tor_relay_streams_total{type="BEGIN_DIR"} 0
    tor_relay_streams_total{type="RESOLVE"} 0
    # HELP tor_relay_traffic_bytes Traffic related counters
    # TYPE tor_relay_traffic_bytes counter
    tor_relay_traffic_bytes{direction="read"} 0
    tor_relay_traffic_bytes{direction="written"} 0
    # HELP tor_relay_dos_total Denial of Service defenses related counters
    # TYPE tor_relay_dos_total counter
    tor_relay_dos_total{type="circuit_rejected"} 0
    tor_relay_dos_total{type="circuit_killed_max_cell"} 0
    tor_relay_dos_total{type="circuit_killed_max_cell_outq"} 0
    tor_relay_dos_total{type="marked_address"} 0
    tor_relay_dos_total{type="marked_address_maxq"} 0
    tor_relay_dos_total{type="conn_rejected"} 0
    tor_relay_dos_total{type="concurrent_conn_rejected"} 0
    tor_relay_dos_total{type="single_hop_refused"} 0
    tor_relay_dos_total{type="introduce2_rejected"} 0
    # HELP tor_relay_load_onionskins_total Total number of onionskins handled
    # TYPE tor_relay_load_onionskins_total counter
    tor_relay_load_onionskins_total{type="tap",action="processed"} 0
    tor_relay_load_onionskins_total{type="tap",action="dropped"} 0
    tor_relay_load_onionskins_total{type="fast",action="processed"} 0
    tor_relay_load_onionskins_total{type="fast",action="dropped"} 0
    tor_relay_load_onionskins_total{type="ntor",action="processed"} 0
    tor_relay_load_onionskins_total{type="ntor",action="dropped"} 0
    tor_relay_load_onionskins_total{type="ntor_v3",action="processed"} 0
    tor_relay_load_onionskins_total{type="ntor_v3",action="dropped"} 0
    # HELP tor_relay_exit_dns_query_total Total number of DNS queries done by this relay
    # TYPE tor_relay_exit_dns_query_total counter
    tor_relay_exit_dns_query_total 0
    # HELP tor_relay_exit_dns_error_total Total number of DNS errors encountered by this relay
    # TYPE tor_relay_exit_dns_error_total counter
    tor_relay_exit_dns_error_total{reason="success"} 0
    tor_relay_exit_dns_error_total{reason="format"} 0
    tor_relay_exit_dns_error_total{reason="serverfailed"} 0
    tor_relay_exit_dns_error_total{reason="notexist"} 0
    tor_relay_exit_dns_error_total{reason="notimpl"} 0
    tor_relay_exit_dns_error_total{reason="refused"} 0
    tor_relay_exit_dns_error_total{reason="truncated"} 0
    tor_relay_exit_dns_error_total{reason="unknown"} 0
    tor_relay_exit_dns_error_total{reason="tor_timeout"} 0
    tor_relay_exit_dns_error_total{reason="shutdown"} 0
    tor_relay_exit_dns_error_total{reason="cancel"} 0
    tor_relay_exit_dns_error_total{reason="nodata"} 0
    # HELP tor_relay_load_oom_bytes_total Total number of bytes the OOM has freed by subsystem
    # TYPE tor_relay_load_oom_bytes_total counter
    tor_relay_load_oom_bytes_total{subsys="cell"} 0
    tor_relay_load_oom_bytes_total{subsys="dns"} 0
    tor_relay_load_oom_bytes_total{subsys="geoip"} 0
    tor_relay_load_oom_bytes_total{subsys="hsdir"} 0
    # HELP tor_relay_load_socket_total Total number of sockets
    # TYPE tor_relay_load_socket_total gauge
    tor_relay_load_socket_total{state="opened"} 0
    tor_relay_load_socket_total 0
    # HELP tor_relay_load_tcp_exhaustion_total Total number of times we ran out of TCP ports
    # TYPE tor_relay_load_tcp_exhaustion_total counter
    tor_relay_load_tcp_exhaustion_total 0
    # HELP tor_relay_load_global_rate_limit_reached_total Total number of global connection bucket limit reached
    # TYPE tor_relay_load_global_rate_limit_reached_total counter
    tor_relay_load_global_rate_limit_reached_total{side="read"} 0
    tor_relay_load_global_rate_limit_reached_total{side="write"} 0

Descubramos qué significan realmente algunas de estas líneas:

### tor_relay_load_onionskins_total{type="ntor",action="dropped"} 0

Cuando un repetidor empieza a ser visto "caído", usualmente es un problema de CPU/RAM.

Tristemente, Tor se ejecuta en instancia única excepto cuando son procesadas las "pieles de cebolla". Las "pieles de cebolla" son el trabajo criptográfico que necesita ser hecho en las famosas "capas de cebolla" en cada circuito.

Cuando tor procesa las capas usamos una reserva de instancias, y le damos todo ese trabajo a esa reserva. Puede pasar que esta reserva empiece a descartar trabajos debido a presión en la memoria o la CPU, y esto desencadenará un estado de sobrecarga.

Si tu servidor se está ejecutando a capacidad, probablemente esto será desencadenado.

### tor_relay_exit_dns_error_total{...}

Un número positivo en la sección "*_dns_error_total" (sin contar la reservada para consultas con éxito) indica potencialmente un problema con DNS. Sin embargo, nos hemos dado cuenta durante el ciclo de publicación de la versión 0.4.7 que los errores DNS son muy comunes y dan lugar a demasiados falsos positivos para que se puedan usar para informar de sobrecarga. Por tanto ya no los usamos para ese propósito a partir de las versiones 0.4.6.9 y 0.4.7.4-alpha. No obstante, no hemos eliminado esta medición de DNS para dar la posibilidad al operador del repetidor de enterarse de qué está haciendo este.

Los errores y problemas de expiración en consultas DNS solo son relevantes en nodos de salida.

### tor_relay_load_oom_bytes_total{...}

Una invocación de memoria agotada indica un problema con la RAM. El repetidor podría necesitar más RAM o está filtrando memoria. Si notaste que el proceso tor está filtrando memoria, por favor infórmanos vía el GitLab de Tor o bien enviando un correo electrónico a la lista de correo tor-relays.

Tor tiene su propio manejador OOM, y es invocado cuando se alcanza el 75% de la memoria total que tor piensa que está disponible. Por lo tanto, digamos que tor cree que puedes usar 2GB en total, entonces a 1.5GB de uso de memoria, comenzará a liberar memoria. Ese es considerado un estado de sobrecarga.

Para estimar la cantidad de memoria disponible, cuando arranques tor, usará `MaxMemInQueues` o, si no está configurado, mirará la RAM total disponible en el sistema y aplicará este algoritmo:

    if RAM >= 8GB {
    memory = RAM * 40%
    } else {
    memory = RAM * 75%
    }
    /* Límite alcanzado. */
    memory = min(memory, 8GB) -> [8GB on 64bit and 2GB on 32bit)
    /* Valor mínimo. */
    memory = max(250MB, memory)

Para evitar un estado de sobrecarga recomendamos ejecutar un repetidor por encima de 2GB de RAM en 64 bits. 4GB es aconsejado, sin embargo, por supuesto, no causa daño agregar más RAM si puedes. Nota: Si estas ejecutando un servidor potente con mucha RAM, puede que termines en un estado de sobrecarga debido al límite de tamaño de cola por defecto de 8GB, incluso aunque tengas mucha RAM sin usar. Añade una entrada `MaxMemInQueues` apropiada a tu configuración `torrc` en ese caso.

Uno podría notar que tor podría ser llamado por el manejador OOM del SO propiamente dicho. Como tor toma la memoria total en el sistema cuando se inicia, si el sistema en general tiene muchas otras aplicaciones ejecutándose usando RAM, termina consumiendo demasiada memoria. En este caso el SO podría hacerle un OOM a tor, sin que este ni siquiera note la presión en la memoria.

### tor_relay_load_socket_total

Si el numero de zócalos abiertos se acerca o es igual al número máximo de zócalos disponibles, esto indica que el repetidor se está quedando sin zócalos libres. La solución es incrementar `ulimit -n` para el proceso tor.

### tor_relay_load_tcp_exhaustion_total

Estas líneas indican que el repetidor está quedándose sin puertos TCP.

Intenta sintonizar `sysctl` como se describió arriba.

### tor_relay_load_global_rate_limit_reached_total

Si este contador es incrementado en algún valor notable sobre un periodo de tiempo corto, el repetidor está congestionado. Probablemente esté siendo usado como Guardián por un servicio cebolla grande o por un ataque DDoS ocurriendo sobre la red.

Si tu repetidor aún está sobrecargado y no sabes por qué, por favor contáctate con network-report@torproject.org. Puedes cifrar tu correo electrónico usando la clave OpenPGP de network-report.