Skip to main content
View rawEdit

No data troubleshooting

Diagnosing and fixing "No data" issues in PostgresAI dashboards.

Quick checklist

  1. ☐ pgwatch container is running
  2. ☐ Target PostgreSQL is reachable
  3. ☐ Credentials are correct
  4. ☐ Required extensions are installed
  5. ☐ Time range includes recent data
  6. ☐ Dashboard variables are set correctly

Step-by-step diagnosis

1. Check pgwatch status

docker compose ps pgwatch

Expected: Up status

If not running:

docker compose logs pgwatch --tail 50

2. Verify PostgreSQL connectivity

# Use PGPASSWORD environment variable for authentication
docker compose exec -e PGPASSWORD="$PGPASSWORD" pgwatch psql \
"postgresql://user@host:5432/dbname" \
-c "select 1"

Common connection errors:

ErrorCauseSolution
could not connect to serverNetwork issueCheck firewall, DNS
password authentication failedWrong credentialsVerify username/password
no pg_hba.conf entrypg_hba.conf missing entryAdd monitoring host to pg_hba.conf
SSL requiredSSL not configuredAdd ?sslmode=require to connection string

3. Check required extensions

-- Connect to target database
select * from pg_extension where extname = 'pg_stat_statements';

If missing:

create extension pg_stat_statements;

Verify it's in shared_preload_libraries:

show shared_preload_libraries;
-- Should include: pg_stat_statements
warning

Adding to shared_preload_libraries requires PostgreSQL restart.

4. Verify metrics collection

# Check pgwatch is scraping
curl http://localhost:8080/metrics | head -20

Expected: Prometheus-format metrics

# Check specific metrics
curl http://localhost:8080/metrics | grep pg_stat_statements_calls

5. Check VictoriaMetrics ingestion

curl 'http://localhost:8428/api/v1/query?query=up'

Expected:

{"status":"success","data":{"result":[...]}}

Check data for specific metric:

curl 'http://localhost:8428/api/v1/query?query=pg_stat_database_xact_commit_total'

6. Verify Grafana data source

curl http://monitor:YOUR_PASSWORD@localhost:3000/api/datasources

Check data source URL points to VictoriaMetrics.

Specific scenarios

No data for pg_stat_statements metrics

Symptoms:

  • Query Analysis dashboard empty
  • Single Query dashboard shows no queries

Causes and solutions:

  1. Extension not installed:

    create extension pg_stat_statements;
  2. Not in shared_preload_libraries:

    # postgresql.conf
    shared_preload_libraries = 'pg_stat_statements'

    Then restart PostgreSQL.

  3. Insufficient track level:

    show pg_stat_statements.track;
    -- Should be 'all' or 'top'
  4. Statistics were reset:

    select stats_reset from pg_stat_database where datname = current_database();

No data for specific database

Symptoms:

  • Some databases show data, others don't
  • Database dropdown shows the database

Causes and solutions:

  1. Extension not installed in that database:

    -- Connect to specific database
    \c problematic_database
    create extension pg_stat_statements;
  2. Database excluded from collection: Check pgwatch configuration for PW_EXCLUDE_DATABASES.

No data for specific cluster

Symptoms:

  • Cluster dropdown shows the cluster
  • All metrics for that cluster are empty

Causes and solutions:

  1. Check connectivity for that specific connection:

    docker compose exec pgwatch psql "connection_string" -c "select 1"
  2. Check pgwatch logs for errors:

    docker compose logs pgwatch | grep "cluster_name"

Data stops after some time

Symptoms:

  • Historical data exists
  • Recent data missing

Causes and solutions:

  1. pgwatch crashed:

    docker compose restart pgwatch
  2. Target PostgreSQL connection dropped: Check network stability and connection timeouts.

  3. VictoriaMetrics storage full:

    df -h /var/lib/docker/volumes/

Dashboard-specific issues

Time range too narrow

Grafana time range may not include collected data:

  • Check "Last 15 minutes" or wider
  • Verify timezone settings

Wrong variable selection

Dashboard variables filter displayed data:

  • Check cluster_name variable
  • Check datname variable
  • Try "All" option if available

Query timeout

Complex dashboards may timeout:

  • Check Grafana query inspector for errors
  • Increase VM_SEARCH_QUERY_TIMEOUT

Permission issues

If pgwatch can connect but gets no data:

-- Check monitoring user permissions
\du monitoring_user

-- Grant required permissions
grant pg_monitor to monitoring_user;
-- or for older PostgreSQL versions:
grant pg_read_all_stats to monitoring_user;

See Permission errors for details.

Still no data?

  1. Collect diagnostic information:

    docker compose logs > monitoring-logs.txt
    docker compose ps >> monitoring-logs.txt
    curl http://localhost:8080/metrics >> monitoring-logs.txt 2>&1
  2. Check GitHub Issues for similar problems

  3. Open a new issue with the diagnostic output