boto3 caught_exception botocore.exceptions.EndpointConnectio

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: boto3 caught_exception botocore.exceptions.EndpointConne

Post 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.
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
sgargano
Posts: 51
Joined: Mon May 23, 2016 9:06 am

Re: boto3 caught_exception botocore.exceptions.EndpointConne

Post 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
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: boto3 caught_exception botocore.exceptions.EndpointConne

Post 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' 
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
sgargano
Posts: 51
Joined: Mon May 23, 2016 9:06 am

Re: boto3 caught_exception botocore.exceptions.EndpointConne

Post 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
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: boto3 caught_exception botocore.exceptions.EndpointConne

Post 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)
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
sgargano
Posts: 51
Joined: Mon May 23, 2016 9:06 am

Re: boto3 caught_exception botocore.exceptions.EndpointConne

Post 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.
You do not have the required permissions to view the files attached to this post.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: boto3 caught_exception botocore.exceptions.EndpointConne

Post 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
You do not have the required permissions to view the files attached to this post.
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
sgargano
Posts: 51
Joined: Mon May 23, 2016 9:06 am

Re: boto3 caught_exception botocore.exceptions.EndpointConne

Post 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
You do not have the required permissions to view the files attached to this post.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: boto3 caught_exception botocore.exceptions.EndpointConne

Post 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?
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
sgargano
Posts: 51
Joined: Mon May 23, 2016 9:06 am

Re: boto3 caught_exception botocore.exceptions.EndpointConne

Post by sgargano »

Yes wizard done and also rebooted the services.
Locked