Dockerized stackdriver agent - payloadErrors in logs - collectd

We have dockerized the stackdriver agent and using /proc volume from base host to monitor processes. In the collectd.log, we are frequently getting below error:
Any clues on this issue?
[2017-12-13 07:07:26] write_gcm: Server response (CollectdTimeseriesRequest) contains errors:
{
"payloadErrors": [
{
"index": 218,
"error": {
"code": 3,
"message": "Expected 4 labels. Found 0. Mismatched labels for payload [values {\n data_source_name: \"value\"\n data_source_type: GAUGE\n value {\n double_value: 483561472\n }\n}\nstart_time {\n seconds: 1513148845\n nanos: 819266918\n}\nend_time {\n seconds: 1513148845\n nanos: 819266918\n}\nplugin: \"processes\"\nplugin_instance: \"all\"\ntype: \"ps_rss\"\n] on resource [type: \"gce_instance\"\nlabels {\n key: \"instance_id\"\n value: \"504805423291753409\"\n}\nlabels {\n key: \"zone\"\n value: \"europe-west1-b\"\n}\n] for project XXXXXXXXXXX"
}
}
]
}

I had the same issue and contacted Google Cloud Support. They told me that the Stackdriver service has been updated recently to accept more detailed information on ps_rss metrics, but it has caused metrics from older agents to not be sent at all.
You should be able to fix this issue by upgrading your Stackdriver agent to the latest version. I recently updated, and haven't seen the issue since.

Related

Microsoft Intune API Bad Request

I was calling the Patch API endpoint for Microsoft Graph API's for Intune in order to update the details of devices present in the portal.
PATCH /deviceManagement/managedDevices/{managedDeviceId}
But in response it is returning Bad Request.
{
"error": {
"code": "BadRequest",
"message": "{ \"_version\": 3, \"Message\": \"An error has occurred - Operation ID (for customer support): 00000000-0000-0000-0000-000000000000 - Activity ID: 2e274924-5fe1-453f-d869-671abf922cfd - Url: https://fef.amsub0502.manage.microsoft.com/DeviceFE/StatelessDeviceFEService/deviceManagement/managedDevices%28%27e002cd5b-f97f-4212-b0b6-38ae3e77938e%27%29/microsoft.management.services.api.shutDown?api-version=5021-04-16\", \"CustomApiErrorPhrase\": \"\", \"RetryAfter\": null, \"ErrorSourceService\": \"\", \"HttpHeaders\": \"{}\"}",
"innerError": {
"date": "2021-05-31T08:44:54",
"request-id": "c869f3f9-def1-4d7f-93af-16b458bc0b17",
"client-request-id": "2e274924-5fe1-453f-d869-671abf922cfd"
}
}
}
I was following every step mentioned in the documentation. We checked the required permissions and all required permissions were provided. We also tried the beta version of API but that also didn't work. So please help me out here if someone knows a fix for this.

Bad Request Response for Microsoft Intune Device Actions

Our company using Microsoft Graph API to retrieve data about devices. Now we are trying to use it for intune device actions but either we are getting error messages even though we followed everything at Microsoft Graph API docs or nothing happens even though API response success.
we checked the permissions and all needed permissions are given.
we followed docs and tried multiple versions of API URLs mentioned in docs but none of them worked.
we also tried the beta version of API but it didn't work either.
We found some readings about some of these actions work specifically on some OS type or some specific device permissions but we can't find detail on docs.
So we want to use all actions on Intune devices but details on docs are not helpful.
I am getting the following error on related actions
POST https://graph.microsoft.com/v1.0/users/{usersId}/managedDevices/{managedDeviceId}/shutDown
{
"error": {
"code": "BadRequest",
"message": "{ \"_version\": 3, \"Message\": \"An error has occurred - Operation ID (for customer support): 00000000-0000-0000-0000-000000000000 - Activity ID: 2e274924-5fe1-453f-d869-671abf922cfd - Url: https://fef.amsub0502.manage.microsoft.com/DeviceFE/StatelessDeviceFEService/deviceManagement/managedDevices%28%27e002cd5b-f97f-4212-b0b6-38ae3e77938e%27%29/microsoft.management.services.api.shutDown?api-version=5021-04-16\", \"CustomApiErrorPhrase\": \"\", \"RetryAfter\": null, \"ErrorSourceService\": \"\", \"HttpHeaders\": \"{}\"}",
"innerError": {
"date": "2021-05-31T08:44:54",
"request-id": "c869f3f9-def1-4d7f-93af-16b458bc0b17",
"client-request-id": "2e274924-5fe1-453f-d869-671abf922cfd"
}
}
}
POST https://graph.microsoft.com/v1.0/users/{usersId}/managedDevices/{managedDeviceId}/remoteLock
{
"error": {
"code": "BadRequest",
"message": "{ \"_version\": 3, \"Message\": \"An error has occurred - Operation ID (for customer support): 00000000-0000-0000-0000-000000000000 - Activity ID: 6676f0a0-8895-302e-672b-3cdb66092428 - Url: https://fef.amsub0502.manage.microsoft.com/DeviceFE/StatelessDeviceFEService/deviceManagement/managedDevices%28%27e002cd5b-f97f-4212-b0b6-38ae3e77938e%27%29/microsoft.management.services.api.remoteLock?api-version=2021-04-07\", \"CustomApiErrorPhrase\": \"\", \"RetryAfter\": null, \"ErrorSourceService\": \"\", \"HttpHeaders\": \"{}\"}",
"innerError": {
"date": "2021-05-31T08:56:10",
"request-id": "a360b06a-fb02-4af3-9f8f-06e138b76288",
"client-request-id": "6676f0a0-8895-302e-672b-3cdb66092428"
}
}
}
I am getting a success response following actions but nothing happens to the devices
POST https://graph.microsoft.com/v1.0/users/{usersId}/managedDevices/{managedDeviceId}/rebootNow
POST https://graph.microsoft.com/v1.0//deviceManagement/managedDevices/{managedDeviceId}/wipe

Google analytics API v4 max results

Can someone please help me for Google analytic API V4:
how to pass: max-result parameter with this class:
Google_Service_AnalyticsReporting
I am unable to find relevant function to assign max-result parameter value.
Based on https://stackoverflow.com/a/38922925/1224827 , the parameter you're looking for is pageSize:
The correct name of the parameter you are looking for is: pageSize. The Reference Docs provide the full API specifications.
def get_report(analytics):
# Use the Analytics Service Object to query the Analytics Reporting API V4.
return analytics.reports().batchGet(
body={
'reportRequests': [
{
'viewId': VIEW_ID,
'pageSize': 10000,
'dateRanges': [{'startDate': '2016-04-01', 'endDate': '2016-08-09'}],
'dimensions': [{'name':'ga:date'},
{'name': 'ga:channelGrouping'}],
'metrics': [{'expression': 'ga:sessions'},
{'expression': 'ga:newUsers'},
{'expression': 'ga:goal15Completions'},
{'expression': 'ga:goal9Completions'},
{'expression': 'ga:goal10Completions'}]
}]
}
).execute()
Note: the API returns a maximum of 100,000 rows per request, no matter how many you ask for (according to the documentation). As you attempted max_results this tells me you are trying to migrate from the Core Reporting API V3, check out the Migration Guide - Pagination documentation to understand how to request the next 100,000 rows.
Stack Overflow extra tip. Include your error responses in your question, as it will likely improve your chances of someone being able to help.
You can use parameter page_size: 10000. Hope this helps.
I checked these docs but couldn't find any example for max-result
v3 doc https://developers.google.com/analytics/devguides/reporting/core/v3/reference#maxResults
v4 batchGet doc https://developers.google.com/analytics/devguides/reporting/core/v4/rest/v4/reports/batchGet
It would be great if someone shares the JSON example of max-result. I'm getting an error message when I add "start-index" : 1 and "max-results": 10
"Invalid JSON payload received. Unknown name \"start-index\" at 'report_requests[0]':
Cannot find field.\nInvalid JSON payload received. Unknown name \"max-results\" at
'report_requests[0]': Cannot find field.", {
Here is my JSON
{
"reportRequests": [
{
"viewId": "112211828",
"dateRanges": [
{
"startDate": "30daysAgo",
"endDate": "yesterday"
}
],
"metrics": [
{
"formattingType": "METRIC_TYPE_UNSPECIFIED",
"expression": "ga:searchUniques"
}
],
"dimensions": [
{
"name": "ga:searchKeyword"
}
],
"orderBys": [
{
"orderType": "VALUE",
"sortOrder": "DESCENDING",
"fieldName": "ga:searchUniques"
}
],
"samplingLevel": "DEFAULT",
"start-index" : 1,
"max-results": 10 // [Uptade] it should be "pageSize": 10
}
]
}
[UPDATE]
"pageSize": 10 is works instead of "max-results"

Fiware Orion context broker subscription notification issue

I'm using orion context broker GE image orion-psb-image-R5.4 version 1.7.0 and I registered a device entity in it , then i implemented in my raspberry pi simple python server script that listens to any incoming message and print it on the Pi's logs . then i sent a subscription message to the context broker to let my raspberry pi subscribe to its corresponding entity in the context broker. The issue is that whenever i update the condition attributes in the entity in the context broker , they're supposed to trigger a notification to the raspberry pi and then the server script in the PI print the notification in the Pi's logs . But what really happens is that the context broker may trigger the notification for several times and then suddenly stops sending any notification when any additional change is applied to the condition attribute , and on every attempt i make i retrieve the subscription status in the context broker and i find that there was a failure stated by the lastfailure attribute giving me the time of my last failed attempt.
I thought the problem could be the connection to my Pi or even in the server script itself but when i launched direct requests from my terminal to the raspberry pi , it prints the all messages immediately even when the update is made from a remote place . So i concluded that the problem is definitely with the context broker and the notification process of the subscription itself .
Here's the subscription request i made :
curl -v contextbrokeraddress:1026/v2/subscriptions -s -S --header "Fiware-Service: XYZ" --header "Fiware-ServicePath: /XYZ" --header 'Content-Type: application/json' \
-d #- <<EOF
{
"description": " Try",
"subject": {
"entities": [
{
"id": "Controller1",
"type": "Controller"
}
],
"condition": {
"attrs": [
"switch",
"datashow"
]
}
},
"notification": {
"http": {
"url": "http://raspberryPiaddress:8080"
},
"attrs": [
"switch",
"datashow"
]
},
"expires": "2040-01-01T14:00:00.00Z",
"throttling": 5
}
EOF
now when the switch attribute is updated with a different value , it may trigger the notification to the raspberry pi for the first time only but then fails on any following attempts.
this is the simple python script that listens to the incoming notifications and print it in its logs:
import socket
HOST, PORT = '', 8080
listen_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
listen_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
listen_socket.bind((HOST, PORT))
listen_socket.listen(1)
while True:
print "listening on port 8080"
client_connection, client_address = listen_socket.accept()
print "notified"
request = client_connection.recv(1024)
print request
client_connection.close()
And this is how the notification from the context broker is printed on the Pi's logs in its successful times:
listening on port 8080
notified
POST / HTTP/1.1
User-Agent: orion/1.7.0 libcurl/7.19.7
Host: raspberryPiaddress:8080
fiware-service: XYZ
Fiware-ServicePath: /XYZ
X-Auth-Token: token
Accept: application/json
Content-length: 208
Content-type: application/json; charset=utf-8
Fiware-Correlator: f48ced60-1069-11e7-b743-fa163e7c4daf
Ngsiv2-AttrsFormat: normalized
{"subscriptionId":"58cd49191e9c000de6ea89c7","data":[{"id":"Controller1","type":"Controller","switch":{"type":"command","value":"OFF","metadata":{}},"datashow":{"type":"string","value":"OFF","metadata":{}}}]}
And when the notification is not received on any following updates on the entity , i check that it was failure by retrieving the subscription status which states that a failure happened in the context broker on sending the notification at the exact time of my attempt. This the status i retrieve to check that:
[
{
"description": " Try",
"expires": "2040-01-01T14:00:00.00Z",
"id": "58cd49191e9c000de6ea89c7",
"notification": {
"attrs": [
"switch",
"datashow"
],
"attrsFormat": "normalized",
"http": {
"url": "http://ahmadpi.ddns.net:8080"
},
**"lastFailure": "2017-03-24T08:22:23.00Z",**
"lastNotification": "2017-03-24T08:22:18.00Z",
"lastSuccess": "2017-03-23T22:09:33.00Z",
"timesSent": 66
},
"status": "failed",
"subject": {
"condition": {
"attrs": [
"switch",
"datashow"
]
},
"entities": [
{
"id": "Controller1",
"type": "Controller"
}
]
},
"throttling": 5
}
]
the problem now seems to be relating to the context broker and the way the subscription/notification processes are handled inside it . Now, i want to know whether the problem regards the context broker image version that i used or whether it regards something else . I just want to know where's the problem and how it can be handled please and thanks so much.
Although I'm not fully sure as don't have all the inputs (specially, CB log traces), by "it worked well as I said but sometimes stops for some reasons" (see comments thread in the question post) I tend to think is some networking/connectivity problem, not directly related with Orion Context Broker.

SoftLayer API Hardware : Fast Provision of BM Server PresetConfiguration OS

Using the Fast Provision of BM Server REST API :
http://sldn.softlayer.com/blog/bpotter/ordering-bare-metal-servers-using-softlayer-api
SoftLayer_Hardware/getCreateObjectOptions : In the response we will get fixed preset configuration,datacenter,operating system details,etc.,
When I provision using OS Reference code ESXI_5.1_64, I am getting the below mentioned error. In the request I have not mentioned networkComponents details and if i add "networkComponents": [{ "maxSpeed": 100 }], details then also i am getting the below mentioned error message.
{
"error": "VMware ESXi 5.5 cannot be ordered with 100 Mbps Public & Private Network Uplinks"
"code": "SoftLayer_Exception_Public"
}
Also if i use some of the operating system reference codes i am getting the below mentioned error.
{
"error": "Unable to match an OS with reference code: XENSERVER_6.0_64"
"code": "SoftLayer_Exception_NotFound"
}
"operatingSystemReferenceCode": "XENSERVER_6.0_64" "operatingSystemReferenceCode": "REDHAT_6_64"
1. The exception:
{ "error": "VMware ESXi 5.5 cannot be ordered with 100 Mbps Public &
Private Network Uplinks" "code": "SoftLayer_Exception_Public" }
Reason: The VMware OSes cannot be ordered with "100 Mbps Public & Private Network Uplinks" (e.g. "networkComponents": [{ "maxSpeed": 100 }]). VMware OSes must be ordered at least with "1 Gbps Public & Private Network Uplinks". (e.g. "networkComponents": [{ "maxSpeed": 1000}]).
2. The exception:
{ "error": "Unable to match an OS with reference code:
XENSERVER_6.0_64" "code": "SoftLayer_Exception_NotFound" }
Probably you are trying to order a hourly server ("hourlyBillingFlag": true), this can be the reason of the exception, because this OS is only available for Monthly billing fee.
Note: If this is not the reason ("hourlyBillingFlag": true), you can attach the code that you are trying, in order to identify the issue and provide more feedback about it.
How identify the type of billing for the items?
Using SoftLayer_Hardware::getCreateObjectOptions method, you will get a response like this:
38: {
"itemPrice": {
"hourlyRecurringFee": ".024"
"recurringFee": "17"
"item": {
"description": "Windows Server 2012 R2 Standard Edition (64 bit)"
}-
}-
"template": {
"operatingSystemReferenceCode": "WIN_2012-STD-R2_64"
}-
}
"hourlyRecurringFee" means that the item is available per hour and "recurringFee" per month. The "XENSERVER_6.0_64" item is only available for month because it only has "recurringFee" property and not "hourlyRecurringFee"property.
The OS ESXI_5.1_64 is not valid for your configured fixedConfigurationPreset (note based in your comments I assume you are using the S1270_8GB_2X1TBSATA_NORAID you did not copy your code :( ). For that preset the valid OS is ESXI_5.5_64. (VMware ESXi 5.5) So try this code:
{
"parameters": [{
"datacenter": {
"name": "dal01"
},
"hostname": "vijvmware",
"domain": "csc.com",
"hourlyBillingFlag": false,
"fixedConfigurationPreset": {
"keyName": "S1270_8GB_2X1TBSATA_NORAID"
},
"operatingSystemReferenceCode": "ESXI_5.5_64",
"networkComponents": [
{
"maxSpeed": 10
}
]
}]
}
Please keep in mind that the SoftLayer_Hardware::getCreateObjectOptions returns all the options to create bare metal, but not all the convinations of options will work, that´s up to you to create the correct configuration for that you may see the UI (Softlayer´s Portal).