payert commented on a change in pull request #3279:
URL: https://github.com/apache/ambari/pull/3279#discussion_r561920338
##########
File path:
ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog275.java
##########
@@ -122,4 +134,169 @@ protected void removeDfsHAInitial() {
blueprintDAO.merge(blueprintEntity);
}
}
+
+ protected void updateAmsGrafanaIniConfig() throws AmbariException {
+ AmbariManagementController ambariManagementController =
injector.getInstance(AmbariManagementController.class);
+ Clusters clusters = ambariManagementController.getClusters();
+ if (clusters != null) {
+ Map<String, Cluster> clusterMap = getCheckedClusterMap(clusters);
+ if (clusterMap != null && !clusterMap.isEmpty()) {
+ for (Cluster cluster : clusterMap.values()) {
+ Set<String> installedServices = cluster.getServices().keySet();
+ if (installedServices.contains("AMBARI_METRICS")) {
+ String contentText =
cluster.getDesiredConfigByType("ams-grafana-ini").getProperties().get("content");
+ if (contentText != null) {
+ String addAfter;
+ String toInsert;
+ String toFind;
+ String toReplace;
+ StringBuilder content = new StringBuilder(contentText);
+
+ addAfter = "; app_mode = production";
+ toInsert = "\n" +
+ "\n# instance name, defaults to HOSTNAME environment
variable value or hostname if HOSTNAME var is empty" +
+ "\n; instance_name = ${HOSTNAME}";
+ insertAfterIfNotThere(content, addAfter, toInsert);
+
+ addAfter = "logs = {{ams_grafana_log_dir}}";
+ String pluginsConfLine = "plugins =
/var/lib/ambari-metrics-grafana/plugins";
Review comment:
Right again.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]