[pve-devel] [manager] A minor enhancement for external metrics to Influxdb and Graphite. So far with the data sent was impossible to know the node that host each lxc/qemu. This small modification allow this. It's very helpful to be able to group lxc/qemu by their host nodes when visualizing data for example with Grafana.

Daniel Gallego Sánchez danielgallegosanchez at gmail.com
Fri Feb 3 19:49:37 CET 2017


Hi,

thanks for a clear answer.


1) could I resend that patch with correct style? and how? I'm new with 
this...

2) I got same problem with graphite, but I could test that with my 
proxmox nodes (I'll notify results).

**What happens when I migrate a VM?

Just new data will have that column changed.

Example:

my host domain.example is on node 01, so their data column are 
host=domain.example nodename=01

If i migrate this MV to my node 02 new data will be like: 
host=domain.example nodename=02.

**With your patch the metrics are of the same VM get collected in 
another entry?

Yes, assuming new entry as new row.

**Can I view the whole VM statistic, independent of the node?

Yes, nodename is simply another data.

**Or can I just view the VM statistic from the time it was on node A and 
must change the query when I migrated it to node B?

You will see that data of that VM changes their column nodename=A to 
nodename=B when you migrated. But if you don't filter by nodename, you 
won't see a difference.

You could know when migration was completed filtering by column "time".

Ex:

           time            |          host                 | nodename

2017/01/30:15:00 | mydomain.example |         A

2017/01/30:16:35 | mydomain.example |         B

2017/01/30:16:45 | mydomain.example |         B


I hope I made myself clear.

Regards


El 03/02/17 a las 13:27, Thomas Lamprecht escribió:
> Hi,
>
> First thanks for the contribution to Proxmox VE.
>
> I've seen two problems with the patch:
> 1) You patch has a style problem, you put the whole commit message in 
> the first line.
> Using a single short line to summarize the patch then a newline then a 
> more verbose description of the patch would be great.
> This makes viewing or searching the commit history much easier.
>
> In your case it could be something like:
>
>  > Status plugins: send nodename when updating CT/VM status
>  >
>  > So far with the data sent was impossible to know the node that host
>  > each lxc/qemu.
>  > This small modification allow this by sending also the nodename.
>  > It's very helpful to be able to group lxc/qemu by their host nodes
>  > when visualizing data for example with Grafana.
>
>
> 2) For influxdb this should be OK.
> But as I have almost no experience with graphite and did not find a 
> documentation regarding their path hierarchy I cannot comment for it.
> What happens when I migrate a VM? With your patch the metrics are of 
> the same VM get collected in another entry?
> Can I view the whole VM statistic, independent of the node? Or can I 
> just view the VM statistic from the time it was on node A and must 
> change the query when I migrated it to node B?
>
> cheers,
> Thomas
>
>
> On 02/03/2017 12:44 PM, Daniel1108 wrote:
>> Regards
>>
>> Signed-off-by: Daniel1108 <danielgallegosanchez at gmail.com>
>> ---
>>   PVE/Service/pvestatd.pm | 4 ++--
>>   PVE/Status/Graphite.pm  | 6 +++---
>>   PVE/Status/InfluxDB.pm  | 8 ++++----
>>   PVE/Status/Plugin.pm    | 4 ++--
>>   4 files changed, 11 insertions(+), 11 deletions(-)
>>
>> diff --git a/PVE/Service/pvestatd.pm b/PVE/Service/pvestatd.pm
>> index f6aaa30..28e497c 100755
>> --- a/PVE/Service/pvestatd.pm
>> +++ b/PVE/Service/pvestatd.pm
>> @@ -203,7 +203,7 @@ sub update_qemu_status {
>>           my $plugin_config = $status_cfg->{ids}->{$id};
>>           next if $plugin_config->{disable};
>>           my $plugin = 
>> PVE::Status::Plugin->lookup($plugin_config->{type});
>> -        $plugin->update_qemu_status($plugin_config, $vmid, $d, $ctime);
>> +        $plugin->update_qemu_status($plugin_config, $vmid, $d, 
>> $ctime, $nodename);
>>       }
>>       }
>>   }
>> @@ -403,7 +403,7 @@ sub update_lxc_status {
>>           my $plugin_config = $status_cfg->{ids}->{$id};
>>           next if $plugin_config->{disable};
>>           my $plugin = 
>> PVE::Status::Plugin->lookup($plugin_config->{type});
>> -        $plugin->update_lxc_status($plugin_config, $vmid, $d, $ctime);
>> +        $plugin->update_lxc_status($plugin_config, $vmid, $d, 
>> $ctime, $nodename);
>>       }
>>       }
>>   }
>> diff --git a/PVE/Status/Graphite.pm b/PVE/Status/Graphite.pm
>> index f8d95d1..f46cb2b 100644
>> --- a/PVE/Status/Graphite.pm
>> +++ b/PVE/Status/Graphite.pm
>> @@ -46,13 +46,13 @@ sub update_node_status {
>>     sub update_qemu_status {
>>       my ($class, $plugin_config, $vmid, $data, $ctime) = @_;
>> -    write_graphite_hash($plugin_config, $data, $ctime, "qemu.$vmid");
>> +    write_graphite_hash($plugin_config, $data, $ctime, 
>> "qemu.$vmid.$nodename");
>>   }
>>     sub update_lxc_status {
>> -    my ($class, $plugin_config, $vmid, $data, $ctime) = @_;
>> +    my ($class, $plugin_config, $vmid, $data, $ctime, $nodename) = @_;
>>   -    write_graphite_hash($plugin_config, $data, $ctime, "lxc.$vmid");
>> +    write_graphite_hash($plugin_config, $data, $ctime, 
>> "lxc.$vmid.$nodename");
>>   }
>>     sub update_storage_status {
>> diff --git a/PVE/Status/InfluxDB.pm b/PVE/Status/InfluxDB.pm
>> index 0cce42b..7364e57 100644
>> --- a/PVE/Status/InfluxDB.pm
>> +++ b/PVE/Status/InfluxDB.pm
>> @@ -38,11 +38,11 @@ sub update_node_status {
>>   }
>>     sub update_qemu_status {
>> -    my ($class, $plugin_config, $vmid, $data, $ctime) = @_;
>> +    my ($class, $plugin_config, $vmid, $data, $ctime, $nodename) = @_;
>>         $ctime *= 1000000000;
>>   -    my $object = "object=qemu,vmid=$vmid";
>> +    my $object = "object=qemu,vmid=$vmid,nodename=$nodename";
>>       if($data->{name} && $data->{name} ne '') {
>>       $object .= ",host=$data->{name}";
>>       }
>> @@ -51,11 +51,11 @@ sub update_qemu_status {
>>   }
>>     sub update_lxc_status {
>> -    my ($class, $plugin_config, $vmid, $data, $ctime) = @_;
>> +    my ($class, $plugin_config, $vmid, $data, $ctime, $nodename) = @_;
>>         $ctime *= 1000000000;
>>   -    my $object = "object=lxc,vmid=$vmid";
>> +    my $object = "object=lxc,vmid=$vmid,nodename=$nodename";
>>       if($data->{name} && $data->{name} ne '') {
>>       $object .= ",host=$data->{name}";
>>       }
>> diff --git a/PVE/Status/Plugin.pm b/PVE/Status/Plugin.pm
>> index 070467c..ff7af89 100644
>> --- a/PVE/Status/Plugin.pm
>> +++ b/PVE/Status/Plugin.pm
>> @@ -62,13 +62,13 @@ sub update_node_status {
>>   }
>>     sub update_qemu_status {
>> -    my ($class, $plugin_config, $vmid, $data, $ctime) = @_;
>> +    my ($class, $plugin_config, $vmid, $data, $ctime, $nodename) = @_;
>>         die "please implement inside plugin";
>>   }
>>     sub update_lxc_status {
>> -    my ($class, $plugin_config, $vmid, $data, $ctime) = @_;
>> +    my ($class, $plugin_config, $vmid, $data, $ctime, $nodename) = @_;
>>         die "please implement inside plugin";
>>   }
>
>
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel




More information about the pve-devel mailing list