Enabling Grafana dashboard for an existing COD database

Learn how to enable the Grafana URL to visualize the Cloudera Operational Database (COD) metrics for an existing COD database.

  • You must whitelist the Cloudera archive URL so that the necessary RPM packages for Grafana can be installed in the instances.
  • You must whitelist the Cloudera repository so that the dashboards are created automatically.
  • You must whitelist the Grafana RPM packages URL so that Grafana can be installed in the instances.
  • You must whitelist the Google API storage URL so that the Cloudera Manager fousquare plugin can be installed.
  • You must attach the following policy for CloudWatch plugin under cdp-infra2-logs-role (or the role with which the ec2 instances are created) to enable the Amazon S3 metrics in Grafana dashboard. To attach a policy under the cdp-infra2-logs-rolee, see Create a cross-account IAM role.
    {
        "Version": "2012-10-17",
    
        "Statement": [
    
    			{ 
    				"Sid": "AllowReadingMetricsFromCloudWatch",
    				 "Effect": "Allow",
    				  "Action": [
    				      "cloudwatch:DescribeAlarmsForMetric",
    				    	"cloudwatch:DescribeAlarmHistory",
    				        "cloudwatch:DescribeAlarms",
    				        "cloudwatch:ListMetrics",
    				        "cloudwatch:GetMetricStatistics",
    				        "cloudwatch:GetMetricData",
    				        "cloudwatch:GetInsightRuleReport" 
    				     ],
    				   "Resource": "*" 
    			},
    
    			{
    			     "Sid": "AllowReadingLogsFromCloudWatch",
    			      "Effect": "Allow", 
    			       "Action": [ 
    			       "logs:DescribeLogGroups", 
    			       "logs:GetLogGroupFields",
    			       "logs:StartQuery",
    			       "logs:StopQuery",
    			       "logs:GetQueryResults", 
    			       "logs:GetLogEvents" 
    			        ],  
    			        "Resource": "*"   
    		     },
    
    			{             
    				"Sid": "AllowReadingTagsInstancesRegionsFromEC2",
    			    "Effect": "Allow", 
    			    "Action": [   
    			    "ec2:DescribeTags",  
    			    "ec2:DescribeInstances",      
    			    "ec2:DescribeRegions"   
    			     ],    
    			      "Resource": "*"    
    			},
    
    			{
    			   "Sid": "AllowReadingResourcesForTags",      
    			   "Effect": "Allow",      
    			   "Action": "tag:GetResources",     
    			   "Resource": "*"    
    			},
    			{             
    				"Sid": "AllowReadingAcrossAccounts",  
    				"Effect": "Allow",        
    				"Action": [    
    			    "oam:ListSinks",        
    			    "oam:ListAttachedLinks"     
    			    ],  
    			     "Resource": "*"  
    			}
        ]
    
    }
  • You must also create a CloudWatch metrics configuration to enable the Amazon S3 metrics in Grafana dashboard. See the steps mentioned under Using the S3 console in Creating a CloudWatch metrics configuration for all the objects in your bucket.
  1. Go to the Cloudera repository and copy these files (grafana-install-configure-v2.sh and configure-knox-for-grafana.sh) to the gateway node of the COD cluster.

    If you are using CDH version 7.2.15, download configure-knox-for-grafana7215.sh file.

    Following is an example command.
    scp -i ~/.ssh/odx-developers.pem ./grafana-install-configure-v2.sh cloudbreak@10.1.1.1:
    scp -i ~/.ssh/odx-developers.pem ./configure-knox-for-grafana.sh cloudbreak@10.1.1.1:
  2. Connect to the gateway node.
    Following is an example command.
    ssh -i ~/.ssh/odx-developers.pem cloudbreak@10.8.2.5
  3. Get the root permission for the folder where you copied the script files.
    Following is an example command.
    sudo -i cd /home/cloudbreak/
  4. Set the owner permission for the script files so that it can run successfully.
    chown root:root *
  5. Run the Grafana installation script.
    Following is an example command.
    ./grafana-install-configure-v2.sh
    extracted string: cod--186yjxqvwcwoh
    Failed to set locale, defaulting to C
    Loaded plugins: fastestmirror, versionlock
    Determining fastest mirrors
    epel/x86_64/metalink                                                                                                                                                   |  27 kB  00:00:00
    * base: download.cf.centos.org
    * centos-sclo-rh: download.cf.centos.org
    * centos-sclo-sclo: download.cf.centos.org
    * epel: ftp-osl.osuosl.org
    * extras: download.cf.centos.org
    * updates: download.cf.centos.org
      base                                                                                                                                                                   | 3.6 kB  00:00:00
      cdp-infra-tools                                                                                                                                                        | 2.9 kB  00:00:00
      centos-sclo-rh                                                                                                                                                         | 3.0 kB  00:00:00
    
    …
    
    Created symlink from /etc/systemd/system/multi-user.target.wants/grafana-server.service to /usr/lib/systemd/system/grafana-server.service. 

    If the command is successful, you must see the symlink created message.

  6. Check the Grafana service status using the systemctl command.
    systemctl status grafana-server.service
    grafana-server.service - Grafana instance
    Loaded: loaded (/usr/lib/systemd/system/grafana-server.service; enabled; vendor preset: disabled)
    Active: active (running) since Tue 2023-08-22 10:51:08 UTC; 16s ago
    Docs: http://docs.grafana.org
    Main PID: 25273 (grafana)
    CGroup: /system.slice/grafana-server.service
    └─25273 /usr/share/grafana/bin/grafana server --config=/etc/grafana/grafana.ini --pidfile=/var/run/grafana/grafana-server.pid --packaging=rpm cfg:default.paths.logs=/var/log/gr...
  7. Run the Knox configuration script.
    Following is an example command.
    ./configure-knox-for-grafana.sh

    If you are using CDH version 7.2.15, use the following command ./configure-knox-for-grafana7215.sh.

    Installing knox service configs for grafana
    Adding GRAFANA service in the cdp-proxy topology
    Adding GRAFANA service in the cdp-proxy topology in the active directory
  8. Restart the Knox service using Cloudera Manager.

The following is a sample Grafana dashboard URL.

https://<GATEWAY-FQDN>/grafanacod/dashboards

You can obtain the value of <GATEWAY-FQDN> from COD DATAHUB > Nodes > Gateway. In the listed table, you can find the FQDN column. For example, https://cod--186yjxqvwcwoh-gateway0.cod-7216.xcu2-8y8x.dev.cldr.work/grafanacod/dashboards.