标签: google-cloud-stackdriver

对堆栈驱动程序指标执行算术

这些不是自定义指标,我只是尝试添加现有的 GCP 指标。

如何在堆栈驱动程序时间序列中添加 2 个指标?

我有两个不同的指标,我想对它们进行求和,这样我就看到一条线——而且我也希望能够针对这个求和指标发出警报。这可能吗?

同样,我不会将指标发送给堆栈驱动程序,而是使用现有的指标来执行此操作。

google-cloud-platform stackdriver google-cloud-monitoring google-cloud-stackdriver

6
推荐指数
0
解决办法
905
查看次数

如何将本地日志与 GCP stackdriver 集成

我正在评估 GCP 的 stackdriver,用于跨多个微服务进行日志记录。其中一些服务部署在本地,一些服务部署在 AWS/GCP 上。我们的服务是基于.NET 或nodejs 的应用程序,并且我们投资了用于nodejs 的winston 和用于.net 的nlog。

我正在寻找将我们的本地 Nodejs 应用程序与 Stackdriver 日志记录集成。查看@ https://cloud.google.com/logging/docs/setup/nodejs文档,似乎我们需要为除谷歌计算实例之外的任何计算机安装代理。它是否正确?

如果我们需要安装代理,那么有什么方法可以在开发过程中测试日志记录吗?开发环境是windows 10/mac。

google-cloud-platform google-cloud-stackdriver

5
推荐指数
1
解决办法
3441
查看次数

Stackdriver 监控图表的算术运算

我正在尝试为我的服务提供的自定义指标设置 Stackdriver 仪表板。

特别是我从一般custom/grpc/time_ms度量开始,它是一个仪表并且上面有status标签。我希望能够设置图表并提醒指标的成功率(类似count:custom/grpc/time_ms{status:OK} / count:custom/grpc/time_ms{*})。

在我之前的项目中,我使用了 Datadog,在那里这样做非常容易。但是我在 UI 和 Stackdriver 文档中都没有看到任何类似的功能。所以我想知道它是否没有记录或根本不支持?

google-cloud-platform stackdriver google-cloud-stackdriver

5
推荐指数
1
解决办法
1726
查看次数

Stackdriver 未显示使用 slf4j 和 log4j2 编写的日志的正确级别

我在 GAE 上部署了一个 Web 应用程序。我正在使用 SLF4j 的 log4j2 实现进行日志记录。

我可以在 stackdriver 控制台上看到我的所有日​​志。但是我所有日志的级别都显示为 stackdriver 下的信息。它没有根据日志级别(如调试、信息、警告和错误)正确分类。

例如,我的log.error("error")也显示在 stackdriver 控制台的信息级别下

但是当我使用 SLF4 (slf4j-jdk14) 的 JUL 实现时。所有日志都在 stackdriver 中以适当的日志级别正确报告。

任何人都可以建议可能是什么问题吗?

这里是 POM。

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.5.10.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
        <exclusions>
                <exclusion>
                  <groupId>org.springframework.boot</groupId>
                  <artifactId>spring-boot-starter-tomcat</artifactId>
          </exclusion>
          <exclusion>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-logging</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.slf4j</groupId>
                <artifactId>jul-to-slf4j</artifactId>
            </exclusion>
          </exclusions>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-log4j2</artifactId>
        <exclusions>
            <exclusion>
                <artifactId>tomcat-embed-logging-juli</artifactId>
                <groupId>org.apache.tomcat.embed</groupId>
            </exclusion>
            <exclusion>
                <artifactId>tomcat-embed-websocket</artifactId>
                <groupId>org.apache.tomcat.embed</groupId> …
Run Code Online (Sandbox Code Playgroud)

google-cloud-platform google-cloud-trace google-cloud-logging stackdriver google-cloud-stackdriver

5
推荐指数
0
解决办法
1094
查看次数

如何在 GCP Stackdriver 上监控 Nvidia GPU 计算/内存使用情况?

我正在尝试监控 Google Cloud Platform 上的 Nvidia GPU 计算/内存使用情况。
默认情况下可以在 GCP Web 控制台上监控 CPU 使用情况,但我需要 Stackdriver 代理来监控 RAM 使用情况(据我所知)。

我的计算引擎实例具有(抢占式)GPU。
我可以通过运行nvidia-smi命令来获取当前的 GPU 使用情况,但我不知道如何让 stackdriver 了解这些指标。

monitoring gpu google-cloud-platform stackdriver google-cloud-stackdriver

5
推荐指数
0
解决办法
3938
查看次数

NGINX 日志在 Stackdriver 中没有 jsonPayload 字段

我有一个基本的 nginx 部署,在 GKE 集群上运行,提供静态内容。我已按照此处的说明为集群配置了 Stackdriver 日志记录(我为现有集群启用了日志记录),并且还启用了此处解释的 Stackdriver Kubernetes 监控功能。日志记录本身似乎工作正常,因为我可以在 Stackdriver 中看到来自 nginx 的日志。

我正在尝试创建一些基于日志的指标,例如已完成的 2xx 请求的数量,但我在 Stackdriver 中的日志条目中获得的只是该字段textPayload。据我了解,在集群上启用 Stackdriver Monitoring 会启动一些 Fluentd 代理(如果运行我可以看到这些代理kubectl get pods -n kube-system),并且它们应该默认启用 nginx 日志解析器(根据此处的文档)。但是,Stackdriver 中显示的日志条目均不具有jsonPayload结构化日志应有的字段。

我正在使用 nginx 的默认log_format配置,并且我已经验证默认的 nginx 解析器能够解析我的应用程序正在写入的日志(我将默认的 Fluentd nginx 解析器插件正则表达式和日志条目从我的应用程序复制到此工具,它能够解析该条目)

我确信我一定错过了一些东西,但我不知道是什么。

编辑:

作为参考,这是我的 NGINX 日志格式:

log_format main '$remote_addr - $remote_user [$time_local] "$request" '
                '$status $body_bytes_sent "$http_referer" '
                '"$http_user_agent"';
Run Code Online (Sandbox Code Playgroud)

到目前为止我已经尝试过以下操作:

  • 将我的 k8s 集群从版本 1.11.5 升级到 …

nginx google-kubernetes-engine google-cloud-stackdriver

5
推荐指数
1
解决办法
1699
查看次数

无法使用基于日志的指标显示数据(指标类型:“计数器”)

我\xe2\x80\x99m 正在努力创建一个带有基于日志指标的 stackdriver 监控的图表。我的指标是一个计数器,默认情况下没有单位。
\n日志可用于我的基于日志的指标,但当我使用我的指标创建图表时,它会显示no data is available for the...
\nHere\xe2\x80\x99s 我的指标确实有效(称为 isOperatorAllowed):

\n\n
resource.type="container"\nresource.labels.namespace_id="default"\njsonPayload.message="CaseForOperator flags"\nlogName="projects/PROJECT-ID/logs/app"\njsonPayload.caseForOperatorFlags.isOperatorAllowed=true\n
Run Code Online (Sandbox Code Playgroud)\n\n

这里\xe2\x80\x99s 我的图表的 JSON 配置

\n\n
{\n  "dataSets": [\n    {\n      "timeSeriesFilter": {\n        "filter": "metric.type=\\"logging.googleapis.com/user/IsOperatorAllowed\\" resource.type=\\"gke_container\\"",\n        "perSeriesAligner": "ALIGN_RATE",\n        "crossSeriesReducer": "REDUCE_NONE",\n        "secondaryCrossSeriesReducer": "REDUCE_NONE",\n        "minAlignmentPeriod": "60s",\n        "groupByFields": [],\n        "unitOverride": "1"\n      },\n      "targetAxis": "Y1",\n      "plotType": "LINE"\n    }\n  ],\n  "options": {\n    "mode": "COLOR"\n  },\n  "constantLines": [],\n  "timeshiftDuration": "0s",\n  "y1Axis": {\n    "label": "y1Axis",\n    "scale": "LINEAR"\n  }\n}\n
Run Code Online (Sandbox Code Playgroud)\n\n

有人知道我\xe2\x80\x99m 做错了什么吗?

\n

charts logging monitoring google-cloud-platform google-cloud-stackdriver

5
推荐指数
1
解决办法
1587
查看次数

如何使用脚本或API在项目之间导出和导入谷歌云监控仪表板?

我已使用 导出仪表板gcloud alpha monitoring dashboards list --format=json,但使用gcloud dashboard createusing file 不起作用,基本上我想从一个项目导出仪表板并将其导入其他项目。

google-cloud-platform google-cloud-monitoring google-cloud-stackdriver

5
推荐指数
1
解决办法
4476
查看次数

如何在 Google Stackdriver Logging 高级查询中将字符串字段与数字进行比较?

我试过

jsonPayload.elapsed_ms > 5000
Run Code Online (Sandbox Code Playgroud)

我显然得到了字符“5”的字典顺序比较,因为我只看到“6”、“7”、“8”、“9”的结果(参见“200”之后每行的最终数字) :

在此输入图像描述

我试过

double(jsonPayload.elapsed_ms)>5000
Run Code Online (Sandbox Code Playgroud)

也是如此,但似乎不是正确的语法。

这里有一整节关于转换的内容,但没有示例。

google-cloud-platform google-cloud-logging stackdriver google-cloud-stackdriver

5
推荐指数
2
解决办法
1691
查看次数

如何自定义 Slack 通知以监控警报

我已经设置了 stackdriver 监控,配置了警报策略,并在事件开始/停止时通过 slack 发送通知以及事件详细信息。

我是否可以自定义用于松弛通知的消息格式?我只想incident_id用条件名称替换文本

示例:我想更改通知:

  • Incident #0.ltt7qsa4gm4k started
  • Incident DiskUsage started

notifications terraform slack google-cloud-monitoring google-cloud-stackdriver

5
推荐指数
0
解决办法
1612
查看次数