我正在设置从 telegraf 收集指标到 influxdb 中。然后grafana使用influxdb作为数据源来显示图表。
我的问题是减少磁盘使用量,所以我想对旧数据(超过 3 天)进行下采样,并保留新数据(少于 3 天)原样(原始)
我尝试了 influxdb 的保留策略(RP)和连续查询(CQ),如指南中所述: https ://docs.influxdata.com/influxdb/v1.2/guides/downsampling_and_retention
influxdb ("telegraf")
+----------------------------+
| |
| +-----------------------+ |
| | table disk_raw | |
| | CURRENT RP (RAW) +---------+
| | (deleted after 3d) | | |
| +-----------------------+ | |CQ (average 30 min of datapoints into 1)
| +-----------------------+ | |
| | table_disk_ds | | |
| | LONGTERM RP +<--------+
| |(downsampled, kept 90d)| |
| +-----------------------+ |
| +<----+
+----------------------------+ …Run Code Online (Sandbox Code Playgroud) 我在 Google Compute Engine 中创建了一个新磁盘。
gcloud compute disks create --size=10GB --zone=us-central1-a dane-disk
Run Code Online (Sandbox Code Playgroud)
它说我需要格式化它。但我不知道如何挂载/访问磁盘?
gcloud compute disks list
NAME LOCATION LOCATION_SCOPE SIZE_GB TYPE STATUS
notowania-disk us-central1-a zone 10 pd-standard READY
Run Code Online (Sandbox Code Playgroud)
新磁盘未格式化。您必须先格式化并安装磁盘,然后才能使用它。您可以在以下位置找到有关如何执行此操作的说明:
https://cloud.google.com/compute/docs/disks/add-persistent-disk#formatting
我试过上面的说明但是 lsblk根本没有显示磁盘
我是否需要创建一个 VM 并以某种方式将其附加到它才能使用它?我的目标是将磁盘安装为独立于 VM的持久 GKE 卷(上次 GKE 升级导致重新创建 VM 和数据丢失)
我有以下问题:我想部署存储帐户,但前提是它不存在。
我使用 az cli 部署脚本检查是否存在:
resource checkStorageAccountExistence 'Microsoft.Resources/deploymentScripts@2020-10-01' = {
name: 'checkStorageAccountExistenceScript'
location: location
kind: 'AzurePowerShell'
identity: identity
properties: {
arguments: '-storageAccountName \'${string(name)}\' -resourceGroupName \'${string(resourceGroupName)}\''
azPowerShellVersion: '3.0'
scriptContent: '''
param([string]$storageAccountName, [string]$resourceGroupName)
$provisioningState = az storage account show --name $storageAccountName --resource-group $resourceGroupName --output tsv --query 'provisioningState'
if ($provisioningState -eq "Succeeded") {$output = $true} else {$output = $false}
Write-Output $output
$DeploymentScriptOutputs = @{}
$DeploymentScriptOutputs['storageAccountExists'] = $output
'''
forceUpdateTag: utcValue
retentionInterval: 'P1D'
}
}
Run Code Online (Sandbox Code Playgroud)
我想部署有条件的存储帐户:
resource storageAccount 'Microsoft.Storage/storageAccounts@2022-09-01' = if (checkStorageAccountExistence.properties.outputs.storageAccountExists == true){ …Run Code Online (Sandbox Code Playgroud) 我的代码没有产生2个进程,我也不知道为什么。我正在使用来自多处理python库的Process。
import os
from multiprocessing import Process
def dummy():
while True:
print(os.getpid())
p1 = Process(target=dummy())
p2 = Process(target=dummy())
p1.start()
p2.start()
p1.join()
p2.join()
Run Code Online (Sandbox Code Playgroud)
预期结果:创建了2个进程-在Windows 7任务管理器中可见,并且我的代码打印了2个不同的进程ID
实际结果:仅运行一个python进程,仅输出一个进程ID。
3480
3480
3480
Run Code Online (Sandbox Code Playgroud) 我无法使用 readJSON 从 JSON 读取所有键“type-XX”
oldJson 字符串:
{
"branch":{
"type-0.2":{"version":"0.2","rc":"1","rel":"1","extras":"1"}}
"type-0.3":{"version":"0.3","rc":"1","rel":"1","extras":"1"}}
}
Run Code Online (Sandbox Code Playgroud)
def branchList = new JsonSlurper().parseText(oldJson['branch'])
echo (branchList.keySet().toString())
Run Code Online (Sandbox Code Playgroud)
但它失败了:
hudson.remoting.ProxyException:groovy.lang.MissingMethodException:没有方法签名:groovy.json.JsonSlurper.parseText()适用于参数类型:(net.sf.json.JSONObject)值:
我想要一个列表 ["type-0.2", "type-0.3"]
groovy jenkins jenkins-plugins jenkins-groovy jenkins-pipeline
azure ×1
azure-bicep ×1
grafana ×1
groovy ×1
influxdb ×1
jenkins ×1
kubernetes ×1
python ×1
python-3.x ×1
retention ×1