Page 2 of 3
Re: boto3 caught_exception botocore.exceptions.EndpointConne
Posted: Wed May 29, 2019 3:59 pm
by scottwilkerson
sgargano wrote:aws cloudwatch get-metric-statistics --metric-name CPUCreditBalance --start-time 2019-05-28T10:18:00Z --end-time 2019-05-28T11:18:00Z --period 3600 --namespace AWS/EC2 --statistics Maximum --dimensions Name=InstanceId,Value=i-xxxxxxx
Curious if we can match this command from check_ec2.py
Code: Select all
./check_ec2.py -P 5 --metricname CPUCreditBalance --statistics Maximum --period 60 --instanceid 'i-xxxx' --accesskeyid 'xxxxxxxxxx' --secretaccesskey 'xxxxxxxxxxx' --region 'eu-central-1' --warning '100:' --critical '25:' -v
of course we aren't going to be able to look back in time like your example just did, and I will assume you are using the same accesskeyid and secret as you are with your command above.
Re: boto3 caught_exception botocore.exceptions.EndpointConne
Posted: Tue Jun 04, 2019 1:33 am
by sgargano
Yes, for obvious reasons I cannot paste those keys, but the result is the same:
Code: Select all
[root@mw1 libexec]# ./check_ec2.py -P 5 --metricname CPUCreditBalance --statistics Maximum --period 60 --instanceid 'i-xxx' --accesskeyid 'xxx' --secretaccesskey 'xxx' --region 'eu-central-1' --warning '100:' --critical '25:' -v
The check has received a response with no data. This is generally caused by an incorrect region name, invalid metric name, or invalid instance ID.
Please verify the following:
Region: eu-central-1
Metric: CPUCreditBalance
Instance ID: i-xxxx
So now, assuming that all the keys, the instance ID, the instance type, the permissions, all looks fine and the "aws cli" test is confirming that everything is correct, what we should try again to let the python check works?
Thanks
Re: boto3 caught_exception botocore.exceptions.EndpointConne
Posted: Tue Jun 04, 2019 1:24 pm
by scottwilkerson
Boy I just tested this on a new eu-central-1 instance and it worked after the instance was up about 10 minutes....
Code: Select all
/usr/local/nagios/libexec/check_ec2.py -P 5 --metricname CPUCreditBalance --instanceid 'i-xxxxxxxxxxxxxx' --accesskeyid 'xxxxxxxxxxxxxxx' --secretaccesskey 'xxxxxxxxxxxxxx' --region 'eu-central-1' --warning '100' --critical '25'
Can you verify the instance shows in the list here and is in eu-central-1
Code: Select all
/usr/local/nagios/libexec/check_ec2.py --getinstances --accesskeyid 'xxxxxxxxxxxxxxx' --secretaccesskey 'xxxxxxxxxxxxxx'
Re: boto3 caught_exception botocore.exceptions.EndpointConne
Posted: Thu Jun 06, 2019 4:11 am
by sgargano
Hi,
looks like we have a different version here:
Code: Select all
[root@libexec]# ./check_ec2.py --getinstances --accesskeyid '' --secretaccesskey ''
Usage: check_ec2.py [options]
check_ec2.py: error: no such option: --getinstances
Code: Select all
[root@libexec]# ./check_ec2.py --version
check_ec2.py, Version 1.0.0a
Where this python is coming from? I suppose by the boto3 installation...so it should be the right one. Am I wrong?
Thanks
Re: boto3 caught_exception botocore.exceptions.EndpointConne
Posted: Thu Jun 06, 2019 11:20 am
by scottwilkerson
Interesting, Can you upgrade to the latest version of the Wizard
Admin -> Manage Config Wizards
Check for updates
I have version 1.1.0 of the wizard which contains 1.0.0 of the plugin (not the a version)
Re: boto3 caught_exception botocore.exceptions.EndpointConne
Posted: Fri Jun 07, 2019 4:27 am
by sgargano
We are currently running on Nagios XI 5.5.10,
checked for Wizard Updates but the latest version available for the EC2 wizard is the 1.0.0.
Re: boto3 caught_exception botocore.exceptions.EndpointConne
Posted: Fri Jun 07, 2019 7:11 am
by scottwilkerson
I'm going to attach the version that is distributed with 5.6.x you can upload through the Manage Wizards page.
I believe it should work fine but if you have trouble let me know I we can revert this.
amazon_ec2.zip
Re: boto3 caught_exception botocore.exceptions.EndpointConne
Posted: Thu Jun 13, 2019 3:20 am
by sgargano
Hi,
yesterday we finally applied this wizard to our Nagios XI.
Now we are able to run successfully the --getinstances command and have the result.
The strange thing is happening now, after we added an instance by the wizard, is that for some check we have the right result, for some other we have the status 'unknown', which sometimes works and sometimes fails.
Any suggestion on this? Seems to be a network issue, which protocol is used by the check_ec2.py? Https?
Thanks
Re: boto3 caught_exception botocore.exceptions.EndpointConne
Posted: Thu Jun 13, 2019 7:01 am
by scottwilkerson
sgargano wrote:Seems to be a network issue, which protocol is used by the check_ec2.py? Https?
Yes.
Did you re-run the wizard after installing the new one?
Re: boto3 caught_exception botocore.exceptions.EndpointConne
Posted: Fri Jun 14, 2019 5:12 am
by sgargano
Yes wizard done and also rebooted the services.