projects
/
gnt-info
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
added "install it" target
[gnt-info]
/
gnt-monitor
diff --git
a/gnt-monitor
b/gnt-monitor
index
a50d4c1
..
3f1dacc
100755
(executable)
--- a/
gnt-monitor
+++ b/
gnt-monitor
@@
-168,27
+168,29
@@
foreach my $instance ( keys %$stat ) {
next if $skip->{$instance};
next if $skip->{$instance};
- print $fh qq{cpu,node=$node,instance=$instance$location cpu=$stat->{$instance}->{cpu},ticks=$stat->{$instance}->{ticks} $t\n};
+ print $fh qq{
ganeti_
cpu,node=$node,instance=$instance$location cpu=$stat->{$instance}->{cpu},ticks=$stat->{$instance}->{ticks} $t\n};
foreach my $disk ( @{ $stat->{$instance}->{disk} } ) {
foreach my $disk ( @{ $stat->{$instance}->{disk} } ) {
- print $fh qq{disk,node=$node,instance=$instance$location },dump4influx( $disk ), " $t\n";
+ print $fh qq{
ganeti_
disk,node=$node,instance=$instance$location },dump4influx( $disk ), " $t\n";
}
foreach my $nic ( @{ $stat->{$instance}->{nic} } ) {
my $vlan = delete $nic->{vlan};
}
foreach my $nic ( @{ $stat->{$instance}->{nic} } ) {
my $vlan = delete $nic->{vlan};
- print $fh qq{nic,node=$node,instance=$instance,vlan=${vlan}$location },dump4influx( $nic ), " $t\n";
+ $vlan = 0 unless defined $vlan;
+ print $fh qq{ganeti_nic,node=$node,instance=$instance,vlan=${vlan}$location },dump4influx( $nic ), " $t\n";
}
}
close($fh);
}
}
close($fh);
-if ( system( 'curl', '-XPOST', $INFLUX, '--data-binary', '@/dev/shm/gnt-monitor.influx' ) == 0 ) {
+if ( system( 'curl', '-
s', '-
XPOST', $INFLUX, '--data-binary', '@/dev/shm/gnt-monitor.influx' ) == 0 ) {
} else {
rename '/dev/shm/gnt-monitor.influx', '/dev/shm/gnt-monitor.influx.bug.' . scalar glob '/dev/shm/gnt-monitor.influx.bug.*';
warn "curl failed: $? $!";
}
} else {
rename '/dev/shm/gnt-monitor.influx', '/dev/shm/gnt-monitor.influx.bug.' . scalar glob '/dev/shm/gnt-monitor.influx.bug.*';
warn "curl failed: $? $!";
}
-sleep $INTERVAL - (time() - $begin_t);
+my $dt = time() - $begin_t;
+sleep $INTERVAL - $dt if $dt > 0 && $dt < $INTERVAL;
} #/while
} #/while