Skip to main content

Connection Issues

Cannot Connect to Certificate Endpoint

Symptoms:
  • Agent logs show “connection refused” or “timeout”
  • Certificates appear as “Unknown” status
Solutions:
  1. Verify the endpoint is reachable:
    openssl s_client -connect hostname:port -servername hostname
    
  2. Check firewall rules:
    telnet hostname port
    # or
    nc -zv hostname port
    
  3. Verify DNS resolution:
    nslookup hostname
    # or
    dig hostname
    
  4. Test with curl:
    curl -vI https://hostname:port
    

Cannot Sync with CertWatch API

Symptoms:
  • “Failed to sync” errors in logs
  • Certificates not appearing in dashboard
Solutions:
  1. Check outbound connectivity:
    curl -v https://api.certwatch.app/health
    
  2. Verify API key:
    • Ensure the key starts with cw_
    • Check the key has cloud:sync scope
    • Generate a new key if expired
  3. Check proxy settings:
    export HTTPS_PROXY=http://proxy:8080
    cw-agent start -c certwatch.yaml
    
  4. Check for corporate firewall:
    • Ensure api.certwatch.app:443 is allowed
    • Check if SSL inspection is interfering

Configuration Issues

Invalid Configuration

Run validation:
cw-agent validate -c certwatch.yaml
Common errors:
ErrorSolution
key must start with 'cw_' prefixCheck your API key format
sync_interval must be at least 30 secondsIncrease sync interval
hostname is requiredAdd hostname to certificate entry
duplicate hostname:portRemove duplicate certificate entries
concurrency must be between 1 and 50Adjust concurrency setting

Agent Name Changed Warning

If you see:
Agent name changed: "old-name" -> "new-name"
Options:
  1. Continue with new agent (recommended for intentional changes):
    cw-agent start -c certwatch.yaml --reset-agent
    
  2. Revert to old name:
    agent:
      name: "old-name"  # Revert this
    

State Issues

State File Corrupted

If the agent won’t start due to state file issues:
# Remove state file (agent will re-register)
rm .certwatch-state.json

# Or reset via command
cw-agent start -c certwatch.yaml --reset-agent --yes
Resetting the agent creates a new agent ID. Existing certificates will be orphaned (moved to dashboard management).

State File Location

The state file is stored alongside your config file:
  • Config: /etc/certwatch/certwatch.yaml
  • State: /etc/certwatch/.certwatch-state.json

Permission Issues

If the agent can’t write the state file:
# Check ownership
ls -la /etc/certwatch/

# Fix permissions
sudo chown certwatch:certwatch /etc/certwatch/
sudo chmod 755 /etc/certwatch/

Logging

Enable Debug Logging

agent:
  log_level: debug
Or via environment:
CW_LOG_LEVEL=debug cw-agent start -c certwatch.yaml

View Logs

Systemd:
journalctl -u cw-agent -f
Docker:
docker logs -f cw-agent
Direct run: Logs output to stdout/stderr.

Log Levels

LevelDescription
debugVerbose output, includes all scan details
infoNormal operation, sync summaries
warnWarnings (e.g., certificate issues)
errorErrors only

Common Error Messages

ErrorCauseSolution
certificate has expiredTarget cert is expiredRenew the certificate
x509: certificate signed by unknown authoritySelf-signed or private CAAgent still reports the cert data
context deadline exceededNetwork timeoutCheck connectivity, increase timeout
connection refusedService not listeningVerify service is running on that port
no such hostDNS resolution failedCheck DNS configuration
i/o timeoutNetwork unreachableCheck firewall and routing
tls: handshake failureTLS version mismatchTarget may require specific TLS version

Performance Issues

High CPU Usage

  1. Reduce concurrency:
    agent:
      concurrency: 5  # Lower from default 10
    
  2. Increase scan interval:
    agent:
      scan_interval: 5m  # Less frequent scans
    

High Memory Usage

  1. Reduce number of certificates per agent
  2. Split across multiple agents if monitoring many endpoints

Getting Help

If you’re still having issues:
  1. Check the logs with debug level enabled
  2. Search existing issues on GitHub
  3. Open a new issue with:
    • Agent version (cw-agent version)
    • Operating system and architecture
    • Relevant log output (sanitize API keys!)
    • Steps to reproduce

Contact Support

Reach out to our support team for assistance.