-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
agent does not report inodes usage #1793
Comments
This issue was marked stale due to lack of activity. It will be closed in 14 days. |
Still relevant to us. |
Hi @nioncode, That the metric is missing is intentional. The short answer is that there's no platform-side Apologies for the lack of response so far. |
@nioncode did you solved this by any other way? I'm trying to monitor inode by creating an alert but I'm stuck in this ops agents problem too. |
@diegopvj yes, we created a custom python script to publish the inodes data of the mountpoint that was relevant to us. We then call this script on our GCP VMs via a systemd timer every minute. import argparse
import subprocess
import time
from google.api import metric_pb2 as ga_metric
from google.cloud import monitoring_v3
INODE_USAGE_METRIC_TYPE = "workload.googleapis.com/inodes_percent_used"
def create_inode_usage_metric(project_id):
client = monitoring_v3.MetricServiceClient()
project_name = f"projects/{project_id}"
descriptor = ga_metric.MetricDescriptor()
descriptor.display_name = "Inode Usage"
descriptor.description = "Tracks the percentage of used inodes on a disk"
descriptor.type = INODE_USAGE_METRIC_TYPE
descriptor.metric_kind = ga_metric.MetricDescriptor.MetricKind.GAUGE
descriptor.value_type = ga_metric.MetricDescriptor.ValueType.DOUBLE
descriptor.unit = "%"
client.create_metric_descriptor(name=project_name, metric_descriptor=descriptor)
def report_inode_usage(project_id, instance_id, instance_zone, used_inodes_percentage):
client = monitoring_v3.MetricServiceClient()
project_name = f"projects/{project_id}"
series = monitoring_v3.TimeSeries()
series.metric.type = INODE_USAGE_METRIC_TYPE
series.resource.type = "gce_instance"
series.resource.labels["instance_id"] = instance_id
series.resource.labels["zone"] = instance_zone
interval = monitoring_v3.TimeInterval({"end_time": {"seconds": int(time.time())}})
point = monitoring_v3.Point(
{"interval": interval, "value": {"double_value": used_inodes_percentage}}
)
series.points = [point]
client.create_time_series(name=project_name, time_series=[series])
if __name__ == "__main__":
parser = argparse.ArgumentParser(
description="Send the 'inode usage' metric to Google Cloud Monitoring."
)
parser.add_argument("project_id", type=str, help="GC Project ID")
parser.add_argument("instance_id", type=str, help="GC Instance ID")
parser.add_argument("instance_zone", type=str, help="GC Instance zone")
parser.add_argument(
"-c", "--create", action="store_true", help="Create the 'inode usage' metric"
)
args = parser.parse_args()
if args.create:
create_inode_usage_metric(args.project_id)
else:
space_usage = (
subprocess.check_output(
"df /mnt/storage --output=itotal,iused | tail -n 1",
shell=True,
)
.decode()
.strip()
)
total_inodes = int(space_usage.split()[0])
used_inodes = int(space_usage.split()[1])
inode_usage = (used_inodes / total_inodes) * 100
report_inode_usage(
args.project_id, args.instance_id, args.instance_zone, inode_usage
) |
Describe the bug
ops-agent seems to not collect the
system.filesystem.inodes.usage
metric.To Reproduce
Steps to reproduce the behavior:
--version=2.48.0
and default config.Expected behavior
Inodes usage should be collected and available in Cloud Monitoring.
Environment (please complete the following information):
Additional context
It seems like the metric is explicitly filtered out in the ops-agent (see
ops-agent/apps/hostmetrics.go
Line 325 in 1246ead
The text was updated successfully, but these errors were encountered: