Getting invocation statistics for a Lambda function.

0

I have a moderate collection of Lambda functions that have been developed over a period of several years and I'm attempting a clean up and rationalisation. As part of this, I am attempting to run some reports on the frequency of invocation and success of these functions over time. I would like to do this programmatically - initially from the command line and subsequently from a Python program. I'm calling "aws cloudwatch get-metric-statistics" with input from a json file :

"aws cloudwatch get-metric-statistics --cli-input-json file://get-stats.json"

where the input file is:
"{
"Namespace": "AWS/Lambda",
"MetricName": "Invocations",
"Dimensions": [
{
"Name": "FunctionName",
"Value": "serverWatchdog"
},
{
"Name": "Resource",
"Value": "serverWatchdog"
}

],  
"StartTime": "2020-12-01T00:00:00",  
"EndTime": "2020-12-05T00:00:00",  
"Period": 360,  
"Statistics": \[  
    "Average"  
],  

"Unit": "Count"  

}"

I know that this function is being called several times per hour - I can see it on the Cloudwatch console. But my CLI command always returns:

{
"Label": "Invocations",
"Datapoints": []
}

Any suggestions as to what I'm doing wrong?

TIA
Martin

Maby
gefragt vor 3 Jahren1879 Aufrufe
2 Antworten
0

get rid of this section (and the leading comma):
{
"Name": "Resource",
"Value": "serverWatchdog"
}

..and try that.

the return is a little lacking, in that what it should say is "function not found"..but instead it looks like it's returning no data for that time range.

beantwortet vor 3 Jahren
0

Thanks for that - it did fix it. It is an aspect of AWS that is not well documented!

Martin

Maby
beantwortet vor 3 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen