Closed azConnectaz closed 8 months ago
Should be fixed now. Was also a bug in render-wallboard.py
- fixed there too.
Now bugs are removed but when I am testing this lambda function , I am getting a response as null and nothing is stored in dynamoDB table.
If i see an error in cloudwatch logs , it is giving error did not get any data sources.
Can you share your wallboard definition file? The GetHistoricalMetrics
Lambda function will only retrieve metrics that you have specified that are required for your wallboard. If there is nothing specific then it won't retrieve any metrics.
I am creating different UI or custom dashboard for that frontend part , basically i want historical data in dynamoDB table .How can i store that historical metric data in dynamo DB like we are doing in process-agent-event.py . I just want that this get-historical-metrics.py function get historical metric and put data in dynamo DB table.
I am not familiar with python brettles, Can you please just modify the lambda function to store the historical metric data in dynamoDB table and just share it . It would be really helpful.
The challenge is that you (might!) have multiple Connect instances and multiple queues within those instances. And there are historical metrics for all of those - so this is an overlapping data namespace; the wallboard can solve that for you.
Start with this:
aws connect list-instances
and getting the Id
field. You can also see it in the console.aws conenct list-queues --instance-id <Connect instance id>
Now you can create a definition file which tells the wallboard which metrics you want to retrieve. If you want to, you can retrieve all of them - you just need to define them in the file.
Look at the example in the README and there is another example in the original blog post - both are simple but you can add the metrics you want - there is a list in the README.
Once you have created the definition file, import it (instructions are in the README). Then the Lambda will place those metrics into the DynamoDB table. Then you can call the API to retrieve the data (or you can go directly to the DynamoDB table). If you want the data in JSON format just put &json=true
on the end of the API call.
The wallboard is designed to be general-purpose. It you want to retrieve all of the metrics you can call the APIs directly - you can use and AWS SDK you like (you don't have to use Python). But the wallboard is designed so that you don't have to do that - you just define what you want and it gets it for you.
Is it Mandatory to have the definition file to write real time and historical data to DynamoDB. I am trying to execute the wallboard-import.py with the definition file but i don't have admin privilege to my system as it was asking for some dependencies and i don't have administrator access to store or get the dependencies. Can i do this using a lambda function.
Ok, but bear in mind that the whole point of writing (and importing) a definition file is so that you're not messing around with the database directly. Also: you can only retrieve historic metrics this way, not real-time metrics (that happens in the RenderWallboard function). So some tips:
For each metric you want to retrieve, create a record in DynamoDB with the following attributes:
Once you've added those records the Lambda function will do the job you want. But again: this is the hard way to get this working. If what you want is all (or some of) the metrics for a queue then why not call the Connect APIs using your favourite SDK?
Thank you Brettles. It really helped.
{ "errorMessage": "unsupported operand type(s) for +: 'int' and 'str'", "errorType": "TypeError", "requestId": "**", "stackTrace": [ " File \"/var/task/get-historical-metrics.py\", line 222, in lambda_handler\n GetConfiguration()\n", " File \"/var/task/get-historical-metrics.py\", line 91, in GetConfiguration\n if time.time() < LastRun+ConfigTimeout:\n" ] }