Metrics and hostnames

Hi all,

With Sensu 0.21 when I run a metrics check, the value returned includes the full FQDN instead of just the short hostname. Example:

[root@enigma ~]# /opt/sensu/embedded/bin/metrics-disk.rb
enigma.domain.com.au.disk.xvda.reads 516600 1449103926
enigma.domain.com.au.disk.xvda.readsMerged 4505 1449103926
enigma.domain.com.au.disk.xvda.sectorsRead 18770041 1449103926
[snip]

Is there a way to either make the metrics return only the short hostname, or no hostname at all? With my backend (InfluxDB) each metric is tagged with the hostname so it’s not needed.

Cheers!

Turns out the InfluxDB plugin supports hostname stripping

As a workaround I’ve renamed my clients from “host” to “host.domain.com.au”

···

On Thursday, 3 December 2015 12:02:29 UTC+11, Boden Garman wrote:

Hi all,

With Sensu 0.21 when I run a metrics check, the value returned includes the full FQDN instead of just the short hostname. Example:

[root@enigma ~]# /opt/sensu/embedded/bin/metrics-disk.rb
enigma.domain.com.au.disk.xvda.reads 516600 1449103926
enigma.domain.com.au.disk.xvda.readsMerged 4505 1449103926
enigma.domain.com.au.disk.xvda.sectorsRead 18770041 1449103926
[snip]

Is there a way to either make the metrics return only the short hostname, or no hostname at all? With my backend (InfluxDB) each metric is tagged with the hostname so it’s not needed.

Cheers!

Hi Boden,

The metrics-disk.rb gets its default scheme from the hostname command. So in your case I guess your hostname is not configured correctly. Could you show us the return value of these 2 commands please:

hostname

hostname --fqdn

Also you can use the --scheme option coming with the sensu plugin. For example you could strip the domain name.

Best Regards,

Ludo

···

On Wed, Dec 2, 2015 at 5:02 PM, Boden Garman bpgarman@gmail.com wrote:

Hi all,

With Sensu 0.21 when I run a metrics check, the value returned includes the full FQDN instead of just the short hostname. Example:

[root@enigma ~]# /opt/sensu/embedded/bin/metrics-disk.rb
enigma.domain.com.au.disk.xvda.reads 516600 1449103926
enigma.domain.com.au.disk.xvda.readsMerged 4505 1449103926
enigma.domain.com.au.disk.xvda.sectorsRead 18770041 1449103926
[snip]

Is there a way to either make the metrics return only the short hostname, or no hostname at all? With my backend (InfluxDB) each metric is tagged with the hostname so it’s not needed.

Cheers!

Ludovic Francois

Cell: +1 747 220 1444
www.msolution.io

Hi Ludovic,

Thanks for the clues! On two different VMs (CentOS 7) both hostname and hostname --fqdn return the full FQDN.

I’ll check why our VMs are configured this way. Thanks again.

···

On Thursday, 3 December 2015 12:22:33 UTC+11, Ludovic Francois wrote:

Hi Boden,

The metrics-disk.rb gets its default scheme from the hostname command. So in your case I guess your hostname is not configured correctly. Could you show us the return value of these 2 commands please:

hostname

hostname --fqdn

Also you can use the --scheme option coming with the sensu plugin. For example you could strip the domain name.

Best Regards,

Ludo

On Wed, Dec 2, 2015 at 5:02 PM, Boden Garman bpga...@gmail.com wrote:

Hi all,

With Sensu 0.21 when I run a metrics check, the value returned includes the full FQDN instead of just the short hostname. Example:

[root@enigma ~]# /opt/sensu/embedded/bin/metrics-disk.rb
enigma.domain.com.au.disk.xvda.reads 516600 1449103926
enigma.domain.com.au.disk.xvda.readsMerged 4505 1449103926
enigma.domain.com.au.disk.xvda.sectorsRead 18770041 1449103926
[snip]

Is there a way to either make the metrics return only the short hostname, or no hostname at all? With my backend (InfluxDB) each metric is tagged with the hostname so it’s not needed.

Cheers!


Ludovic Francois

Cell: +1 747 220 1444
www.msolution.io

Ah, it looks like the default behavior has changed?

[root@enigma ~]# hostname --version
hostname 3.13
[root@enigma ~]# hostname
enigma.domain.com.au
[root@enigma ~]# hostname --short
enigma
[root@enigma ~]# hostname --fqdn
enigma.domain.com.au

root@sigma:~# hostname --version
hostname 3.11
root@sigma:~# hostname
sigma
root@sigma:~# hostname --short
sigma
root@sigma:~# hostname --fqdn
sigma.domain.com.au

Perhaps Sensu should use the --short option explicity?

···

On Thursday, 3 December 2015 12:29:16 UTC+11, Boden Garman wrote:

Hi Ludovic,

Thanks for the clues! On two different VMs (CentOS 7) both hostname and hostname --fqdn return the full FQDN.

I’ll check why our VMs are configured this way. Thanks again.

On Thursday, 3 December 2015 12:22:33 UTC+11, Ludovic Francois wrote:

Hi Boden,

The metrics-disk.rb gets its default scheme from the hostname command. So in your case I guess your hostname is not configured correctly. Could you show us the return value of these 2 commands please:

hostname

hostname --fqdn

Also you can use the --scheme option coming with the sensu plugin. For example you could strip the domain name.

Best Regards,

Ludo

On Wed, Dec 2, 2015 at 5:02 PM, Boden Garman bpga...@gmail.com wrote:

Hi all,

With Sensu 0.21 when I run a metrics check, the value returned includes the full FQDN instead of just the short hostname. Example:

[root@enigma ~]# /opt/sensu/embedded/bin/metrics-disk.rb
enigma.domain.com.au.disk.xvda.reads 516600 1449103926
enigma.domain.com.au.disk.xvda.readsMerged 4505 1449103926
enigma.domain.com.au.disk.xvda.sectorsRead 18770041 1449103926
[snip]

Is there a way to either make the metrics return only the short hostname, or no hostname at all? With my backend (InfluxDB) each metric is tagged with the hostname so it’s not needed.

Cheers!


Ludovic Francois

Cell: +1 747 220 1444
www.msolution.io