Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
gcmetrics
Advanced tools
Readme
This is a command line for interactive with google cloud platform - cloud monitoring api.
npm install gcmetric -g
In the auth flow, it needs service account for implement Oauth2.0 authentication. Here, we need to prepare the account email and the pem key for auth. And the project id also need to specify in the auth command.
gcmetric -t auth \
-s 288173501788-9fh14iojjmehakjtgkhoubdiaguppn1h@developer.gserviceaccount.com \
-k /Users/peihsinsu/.gcpkeys/mitac-cp300-taipei101/mitac-cp300-taipei101-8c0662095ef9.pem \
-p mitac-cp300-taipei101
In the command, the parameters are:
gcmetric -t init -n mymetric
gcmetric -t simple -n mymetric -d 2000
gcmetric -t init -n mymetric2 -i firstid -d "test first id"
gcmetric -t labeled -n mymetric2 -d 1234
You can create a multiple metric descriptor into a custom metric:
gcmetric -t init -n mymetric3 -j '[{
"key": "custom.cloudmonitoring.googleapis.com/id1",
"description": "This is ID1."
},{
"key": "custom.cloudmonitoring.googleapis.com/id2" ,
"description": "This is ID2."
}]'
In this case, you can write the id1 and id2 type of data into the metric: mymetric3.
Write data with specify the metric descriptor.
gcmetric -t labeled \
-j '{"custom.cloudmonitoring.googleapis.com/id2":"id222"}' \
-n mymetric3 \
-d 1230
You can also write your custom json data as input to cloud monitoring.
gcmetric -t custw \
-j '{
"timeseries":[
{
"timeseriesDesc":{
"project":"mitac-cp300-taipei101",
"metric":"custom.cloudmonitoring.googleapis.com/mymetric3",
"labels":{
"custom.cloudmonitoring.googleapis.com/id2":"id222"
}
},
"point":{
"start":"2015-06-23T11:31:23.781Z",
"end":"2015-06-23T11:31:23.781Z",
"doubleValue":"1230"
}
}
]
}'
In the write customize metric data sample, you can write more timeseries in the array in one request. It helps for the performance.
You can also delete the metric by using delete like:
gcmetric -t delete -p mitac-cp300-taipei101 -n mymetric
For some reason, you may need to retrieve the metric data from the project. You can use the following sample for retrieve the data from command line.
gcmetric -t get -p mitac-cp300-taipei101 -n mymetric
You can also specify the youngest and oldest in the option json data for restrict the interval.
gcmetric -t get -p mitac-cp300-taipei101 -n mymetric -d '{"youngest":"2015-6-22 23:18","oldest":"2015-6-22 23:15"}'
gcmetric -h
Usage: gcmetric [options]
Options:
-h, --help output usage information
-V, --version output the version number
-p, --project <project> google cloud platform project id
-s, --service_account <service_account> service account email
-k, --key <key> service account pem key
-t, --type <type> auth | init | simple | labeled
-n, --name <name> metric name
-i, --id <id> metrics id
-d, --data <data> metrics data value
-j, --jsondata <jsondata> metrics original json data
-l, --loglevel <loglevel> log level
FAQs
Google Cloud Custom Metric command tool
The npm package gcmetrics receives a total of 1 weekly downloads. As such, gcmetrics popularity was classified as not popular.
We found that gcmetrics demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.