code: public static JSONArray monitorForMemory() {
          Map<String, Cache> CACHE = Redis.unmodifiableCache();
  
          JSONArray monitors = new JSONArray();
  
          if (CACHE == null || CACHE.isEmpty())
              return monitors;
  
          JSONObject monitor = new JSONObject();
          monitor.put("application", EnvUtil.getApplication());
          monitor.put("nodeId", LocalNodeManager.LOCAL_NODE_ID);
  
          for (Map.Entry<String, Cache> entry : CACHE.entrySet()) {
              Cache cache = entry.getValue();
              if (cache == null)
                  continue;
  
              try (Jedis jedis = cache.getResource()) {
                  monitor.put("instance", cache.getName());
  
                  String info = ServerOperate.info(jedis, "memory");
  
                  double used_memory = Double.parseDouble(ServerOperate.getAttributeInInfo(info, "used_memory")); // Redis 分配的内存总量
                  monitors.add(new JSONObject() {{
                      putAll(monitor);
  
                      put("value", used_memory / 1024 / 1024); // N  / 1024 (KB) / 1024 (MB)
                      put("name", "UsedMemory");
                  }});
  
  //                double used_memory_peak = Double.parseDouble(ServerOperate.getAttributeInInfo(info, "used_memory_peak")); // Redis 的内存消耗峰值
  //                monitors.add(new JSONObject() {{
  //                    putAll(monitor);
  //
  //                    put("value", used_memory_peak / 1024 / 1024);
  //                    put("name", "UsedMemoryPeak");
  //                }});
              } catch (Exception e) {
                  LOG.error(String.format("Jedis Pool: %s (Grafana) monitor 出现异常", entry.getKey()), e);
              }
          }
  
          return monitors;
      }
docs: 内存信息
  
  @return