smeserver-zabbix-agent/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_netStats
2012-06-14 12:16:52 +02:00

63 lines
2.2 KiB
Plaintext

# Some networks statistics
# zabbix agent support natively interface stats, but, it's hard to create templates for a lot of
# SME Servers which can use different interface name (External can be eth0, eth1, ppp0 etc...)
# This way, net.if.in.internal, net.if.in.external, net.if.out.internal and net.if.out.external
# will always refers to the correct interface.
{
my $internal = $InternalInterface{'Name'} || 'eth0';
my $external = $ExternalInterface{'Name'} || 'eth1';
# Do we use the bridge contrib ?
# If yes, we reports only the traffic on the real ethernet interface.
if ( (($bridge{'status'} || 'disabled') eq 'enabled') && (defined $bridge{'ethernetInterface'}) ){
$internal = $bridge{'ethernetInterface'};
}
$OUT .=<<"HERE";
# Description: In Internal
# Type: Agent or Agent (active)
# Key: net.if.in.internal
# Type of information: Numeric (float)
# Units: b/s
# Custom multiplier: 8 (if you want the value in bits/s instead of Bytes/s)
# Store Value: Delta (speed per second)
UserParameter=net.if.in.internal,cat /proc/net/dev | grep $internal | cut -d":" -f2 | awk '{print \$1}'
# Description: Out Internal
# Type: Agent or Agent (active)
# Key: net.if.out.internal
# Type of information: Numeric (float)
# Units: b/s
# Custom multiplier: 8 (if you want the value in bits/s instead of Bytes/s)
# Store Value: Delta (speed per second)
UserParameter=net.if.out.internal,cat /proc/net/dev | grep $internal | cut -d":" -f2 | awk '{print \$9}'
HERE
if (($SystemMode || 'serveronly') ne 'serveronly'){
$OUT .=<<"HERE";
# Description: In External
# Type: Agent or Agent (active)
# Key: net.if.in.external
# Type of information: Numeric (float)
# Units: b/s
# Custom multiplier: 8 (if you want the value in bits/s instead of Bytes/s)
# Store Value: Delta (speed per second)
UserParameter=net.if.in.external,cat /proc/net/dev | grep $external | cut -d":" -f2 | awk '{print \$1}'
# Description: Out External
# Type: Agent or Agent (active)
# Key: net.if.out.external
# Type of information: Numeric (float)
# Units: b/s
# Custom multiplier: 8 (if you want the value in bits/s instead of Bytes/s)
# Store Value: Delta (speed per second)
UserParameter=net.if.out.external,cat /proc/net/dev | grep $external | cut -d":" -f2 | awk '{print \$9}'
HERE
}
}