I'm trying to have instance group on compute engine autobalanced according my custom metric.
The google monitoring/api/v3 sample github source creates custom metric and I can see it in Stackdriver. Great!
But when I want to use that metric in my instance group, the group is not autoscaled. Only 1 instance is presented.
Am I doing autoscaler setup correctly?
gcloud compute instance-groups managed set-autoscaling $MY_GROUP \
--max-num-replicas 2 --min-num-replicas 1 \
--custom-metric-utilization metric=custom.googleapis.com/custom_measurement,utilization-target=3,utilization-target-type=GAUGE \
--zone us-central1-f
Note: in custom_metric.py I have set INSTANCE_ID to id of my 1st VM instance and run custom_metric.py multiple times to simulate some data, because my test VM instance does nothing real.
V3 API currently won't work with autoscaler, mate, only shows up in Stackdriver.
Note: Autoscaler does not yet support Google Cloud Monitoring V3.
If you want to scale on custom metrics - use V2 API. It's deprecated (and won't show up in Stackdriver), however, still one and only way to make autoscaler work on your own metrics. It's an answer I got today for support ticket.
Related
Using the Dynatrace SaaS GUI in Multidimensional analysis menu I am able to split and filter metrics with request attributes, but I can't find any document on how is the syntax to do the same with the environment v2 API (/metrics/query).
Thanks!
The documentation of the metric query API describes the metricSelector parameter, which is used to select the metric to query and to perform operations on it, e.g. splitting by dimension or filtering based on some values.
You can develop and test the metric-selector in the UI via menu item "Metrics" -> then search for the metric and in the data-explorer build your metric query via "split by" and "filter", then the tab "Code" will show the corresponding metricSelector that you can use also in the query-API.
E.g. a possible metric-query looks like follows:
sample.metric:filter(and(in("dt.entity.process_group_instance",entitySelector("type(process_group_instance),tag(~"Prod~")")))):splitBy("dt.entity.process_group_instance",rx_pid):avg:auto:sort(value(avg,descending)):limit(10)
The documentation for the metric selector explains details and contains many more examples.
I am trying to monitor S3 folder level metrics, trying to get a comparison between two folders.
s3://logs-bucket/error/2019/01/
s3://logs-bucket/info/2019/01/
I spent an hour playing around with CloudWatch metrics but still have no idea how to do it. I am not trying to do anything fancy, just trying to graph NumberOfObjects and BucketSizeBytes between 2 folders. Is sub-level metrics a paid feature?
CloudWatch provides only bucket level metrics by default. But you can define additional metrics via filters (S3 bucket->Management->Metrics->Filters). Define new metric filter per each prefix (/error/2019/01/,/info/2019/01/). Then you can use FilterId as a dimension in the CloudWatch S3 query.
Doc: https://docs.aws.amazon.com/AmazonS3/latest/dev/cloudwatch-monitoring.html
Update: #Tartaglia is right, filters are only for request metrics => you can't get NumberOfObjects andBucketSizeByteswithFilterId` dimension. So you can't use default CloudWatch functionality for your monitoring. You can script/code it and push requested metrics as a custom metrica to the CloudWatch.
I am using the following API's to get information about a particular virtual Guest. Can some one help me get the information with one single api by combining the following?
To get VM's operating system:
https://api.softlayer.com/rest/v3/SoftLayer_Virtual_Guest/$virtualGuestID/getOperatingSystem
Similarly To get the PoD
getFrontendRouters
Get provisioned date for a VM
getProvisionDate
Get attached Network Storage
getAttachedNetworkStorages
Replacing $virtualGuestID with the actual VM ID
You can use object masks:
GET https://$USERNAME:$APIKEY#api.softlayer.com/rest/v3.1/SoftLayer_Virtual_Guest/$VSIID/getObject?objectMask=mask[provisionDate,operatingSystem,frontendRouters,allowedNetworkStorage]
Regards
I am wondering if there is a way to pull Google Analytics un-sampled historical data for 2 years via API using CC Rest connector component. Unfortunately the GA account is a standard and not a premium so I can not get around 500K limit.
It would be great if GoodData Developer team can share an ETL graph file to solve this request. It is a common use case per clients.
Thanks,
Andy
I have discovered this kind of solution.
Run the ga_00_master graph that will run multiple time the ga_01_sub graph. For each day you want to have the data it will send a request to Google Analytics and gives you a file with the data for that day.
There are few things to do
fill in GA_CONNECTION to sub graph
and link parameter file ga_params.prm
and parameters
for master graph:
GA_MIN_DATE = "yyyy-MM-dd"
for sub graph:
PROFILE_NUMBER
Edit refurbished the question that was not clear
New to GA, I'm looking at the way to retrieve automatically custom variables data statistics
The query would have
a start and an end dates (possibly equal)
a variable name
For instance, a Page-level variable Brand takes only three possible values, that are set by the web server, and seen by the client.
The values are Apple, Google and Microsoft.
The query to Google-Analytics could be something like (pseudo-code), provided that I use an authentication token previously acquired
...getstatistics?myToken=123&variable=Brand&datefrom=20110121&dateto=20110121
And the result could be some xml like data
<variable>Brand</variable><value>Apple</value><count>3214</count>
<variable>Brand</variable><value>Google</value><count>4321</count>
<variable>Brand</variable><value>Microsoft</value><count>1345</count>
Meaning for instance that the page-level custom variable Brand was set to the value Apple by the web server (and thus seen by the client / sent to GA) 3214 times.
What is the correct way/protocol to query values/statistics from GA, in order to get statistics related to custom variables?
So, this is my understanding of what you're doing:
You're setting page-level custom variables (important technical note: these need to be called before the _trackPageview or some other call, else they won't be tracked.)
Your code might looks something like this:
_gaq.push(['_setCustomVar', 2, 'Brand', 3]);
Now, when querying the Google Analytics API, its important to note that the slot # is very important, since the slot you're accessing is explicitly named in the query.
So, to do this, you'd need to set your dimensions to ga:customVarName2 and ga:customVarValue2, and decide what metric you're interesting it getting. You mention Page views, so you'd use ga:pageviews. (You're by no means limited to pageviews. You can use any Metric besides a couple of the AdWords specific ones.)
This query would return you all of the custom variable from this slot, and the number of pageviews associated with them.
You also mentioned you'd want to be able to filter by value.
You'd do that by setting the filter value to something like ga:customVarValue2==Apple.
You can see what a query like that would look like here in the query explorer.
Here's a sample screenshot:
Finally, all Google Analytics API queries by default require you to set a date range, so you could query that on your own.
All you need to do is decide which library you want to use as interface, and you're set to go.
Google has a handy resource, called the Google Analytics Data Explorer that can help answer a lot of your questions by letting you experiment through an interface, as long as you login with your Google Analytics credentials.
As you add parameters using their tools, the system will automatically build your URL/Query.
If that's not enough, Google also has some Interactive Examples using JavaScript. Like the Data Explorer, you can also login with your Google Analytics credentials and run the examples to see what data would be returned.
These tools are awesome because they help take the guesswork out of figuring out how to target the exact data you're searching for.