GRAFANA

Grafana is used to visualize and analyze data. Open http://servername:81/grafana to access the sign-in page. The default username and password are admin/admin.

register imageGrafana sign-in page

Open Home -> Dashboards -> Plan-r.

register imageOpening the built-in PLAN-R dashboard

This dashboard is preconfigured. After opening it, select a label and value in the top panel, for example, service_name with the value planr, to filter and display logs. To enable extended logging, set the environment variable LOGS_EXTEND=true.

register imageExample of the PLAN-R dashboard output

To view logs from all containers, select Explore -> Label filters -> Select label (service_name) -> Select value(planr) ->Run Query.

register imageViewing logs from all containers

To view logs from a specific container, such as planr-proxy-1, use the JSON parser. Select hint: add json parser -> Operations -> Label filters -> Label filter expression -> Label (container_name) -> Value (/planr-proxy-1) -> Run query.

register imageViewing logs from a specific container

To save logs to a file, click Downloads and select the file format.

register imageSaving logs

To create a new user, select Administration -> Users and access -> Users -> New user -> Create user.

register imageCreating a new user

To add LDAP authentication to Grafana through Active Directory integration, see https://grafana.com/docs/grafana/next/setup-grafana/configure-security/configure-authentication/ldap/?src=FB&plcmt=footer

Create an AD account with permission to read user information. This account will be used to query LDAP.

register image

Next, create an ldap.toml file on the Docker host. Place it in /opt/dpmm/plan/, alongside the docker-compose file.

[servers]
# General LDAP/AD server connection settings
host = "10.10.22.12"  # IP address or domain name of the domain controller
port = 636  # LDAPS port (LDAP secured with SSL). Use 389 for connections without SSL.
use_ssl = true  # Use SSL/TLS to encrypt the connection
start_tls = false  # Do not use STARTTLS; SSL is already used directly
ssl_skip_verify = true  # Skip SSL certificate validation (not recommended for production)

# Credentials for connecting to AD
bind_dn = "cn=ldap,cn=Users,dc=dpractices,DC=local"  # Account used to connect to LDAP
bind_password = "password"  # Password for the specified account

# User search settings
search_filter = "(|(sAMAccountName=%s)(displayName=%s))"  # Search filter by login or name
search_base_dns = ["DC=dpractices,DC=local"]  # Base DN for the search (entire domain tree)

# Map AD attributes to Grafana user fields
[servers.attributes]
name = "givenName"  # First name (givenName attribute in AD)
surname = "sn"  # Last name (sn attribute in AD)
username = "sAMAccountName"  # Login (sAMAccountName attribute in AD)
email = "mail"  # Email (mail attribute in AD)
member_of = "memberOf"  # User groups (memberOf attribute in AD)

# Permission settings based on AD groups
[[servers.group_mappings]]
group_dn = "cn=Domain Admins,cn=Users,dc=dpractices,dc=local"  # Domain administrators group
org_role = "Admin"  # Grafana role: Administrator
grafana_admin = true  # Grant Grafana administrator permissions

# Commented-out example mapping for editors
#[[servers.group_mappings]]
#group_dn = "cn=Редакторы графаны,ou=Группы безопасности,dc=dpractices,dc=local"
#org_role = "Editor"  # Grafana role: Editor

# Mapping for all other users (wildcard *)
[[servers.group_mappings]]
group_dn = "*"  # All users not matched by the preceding groups
org_role = "Viewer"  # Grafana role: Viewer

After creating ldap.toml, edit the Docker Compose file to add the environment and volumes settings.

 grafana:
    image: grafana/grafana:11.1.0
    container_name: grafana
    restart: *default-restart-policy
    environment:
      GF_RENDERING_SERVER_URL: http://renderer:8081/render
      GF_RENDERING_CALLBACK_URL: http://grafana:3000/
      GF_LOG_FILTERS: rendering:debug
      GF_SERVER_ROOT_URL: "%(protocol)s://%(domain)s:%(http_port)s/grafana/"
      GF_SERVER_SERVE_FROM_SUB_PATH: "true"
      GF_ANALYTICS_ENABLED: "false"
      GF_ANALYTICS_REPORTING_ENABLED: "false"
      GF_ANALYTICS_CHECK_FOR_UPDATES: "false"
      GF_ANALYTICS_CHECK_FOR_PLUGIN_UPDATES: "false"
      GF_AUTH_LDAP_ENABLED: "true"  # Enables or disables LDAP authentication
      GF_AUTH_LDAP_CONFIG_FILE: "/etc/grafana/ldap.toml" # Path to the file containing the LDAP settings
      GF_AUTH_LDAP_ALLOW_SIGN_UP: "true"  # Allow sign-in without prior registration
    volumes:
      - grafana:/var/lib/grafana
    # When using Portainer, specify the absolute path to the configuration files.
    # For example:
      # - /opt/dppm/planr/logging/grafana/provisioning:/etc/grafana/provisioning
      # - ./logging/grafana/provisioning:/etc/grafana/provisioning
      - ./logging/grafana/provisioning/:/etc/grafana/provisioning:/etc/grafana/provisioning
      - ./logging/grafana/ldap/ldap.toml:/etc/grafana/ldap.toml # Mount the ldap.toml configuration file
    networks: *default-network
    profiles : ['logging', 'all']

Restart Grafana to apply the new settings. Run docker restart grafana, or run ./stop.sh to stop all containers and then ./start.sh to start them again.

To test LDAP authentication in Grafana, open Home -> Administration -> Authentication -> LDAP and enter a username from the Active Directory domain in the dialog.

register image

Try signing in to Grafana with a domain account that has the minimum role, Viewer.

register image

LDAP authentication was successful.

register image


608.0-5d1f26c7