Untar to a specific target directory

tar xvf /opt/metricbeat.tar.gz -C /opt/metricbeat --strip-components=1
If the tar-file already contains a directory, you have to add –strip-components=1. Otherwise the directory contained in the tar files is created. Also mind that the directory used for -C has to exist beforehand.