Sie sind auf Seite 1von 13

#!

/usr/bin/perl
#
use Time::localtime;
use Net::SNMP;
$hostname = shift; # Switch hostname in Zabbix
$hostip = shift; # IP of the switch
$ptpct = shift; # Port trigger will fire at this % load
# = 0 for no port triggers
$cstring = shift; # Switch SNMP community string
$slow = shift; # Delay factor for all items
@groups = @ARGV; # Host groups in Zabbix
unless (defined($hostip)) {
print "Usage: $0 HOSTNAME IP [PORTLOAD] [MEMLOAD] [COMMUNITY] [MINUTES]
[GROUPS]\n";
print "Host name and IP are required parameters\n";
print "Example: $0 localhost 127.0.0.1 75 5 public 5 lab-cisco\n";
exit;
}
$hostname="Template_".$hostname;
unless (defined($ptpct)) {$ptpct = 75};
unless (defined($mem_ptpct)) {$mem_ptpct = 5};
unless (defined($cstring)) {$cstring = 'public'};
unless (defined($slow)) {$slow = 5};
unless (defined(@groups)) {@groups =('Cabletron')};
print "\nHost:\t\t$hostname\nIP:\t\t$hostip\nPercent:\t$ptpct\nComm string:\t$cs
tring\n";
print "Slow:\t\t$slow\nGroups:\t\t$groups[0]\n";
#print "OK?";
#$ok = <>;
#chomp $ok;
#unless ($ok eq 'Y') {exit};
sub get_dt() {
my $yr = localtime->year() - 100;
my $mn = localtime->mon() + 1;
my $dy = localtime->mday();
my $hr = localtime->hour();
my $mi = localtime->min();
$dt = sprintf("%2.2d.%2.2d.%2.2d",$dy,$mn,$yr);
$tm = sprintf("%2.2d.%2.2d",$hr,$mi);
$dtm = sprintf("%2.2d%2.2d%2.2d%2.2d%2.2d",$yr,$mn,$dy,$hr,$mi);
}
sub start_snmp() {
($session, $error) = Net::SNMP->session(
-hostname => $hostip,
-port => 161,
-version => 2,
-community => $cstring
);
if (!defined($session)) {
printf("ERROR: %s.\n", $error);
exit 1;
}
}
sub numerically { $a <=> $b;}
sub get_ifTable() {
$ifindex = '.1.3.6.1.2.1.2.2.1.1';
$ifdesc = '.1.3.6.1.2.1.2.2.1.2';
$iftype = '.1.3.6.1.2.1.2.2.1.3';
$ifspeed = '.1.3.6.1.2.1.2.2.1.5';
start_snmp();
my @columns = ($ifindex, $ifdesc,$iftype,$ifspeed);
$iftable = $session->get_entries(-columns => \@columns);
unless (defined($iftable)) {
printf("ERROR: %s.\n", $session->error);
exit 1;
}
foreach $k (keys %$iftable) {
print "$k\n";
}
$session->close();
}
sub get_ports() {
$ifNumber = '.1.3.6.1.2.1.2.1.0';
$result = $session->get_request(
-varbindlist => [$ifNumber]
);
$numports = $result->{$ifNumber};
print "Num Ports: $numports\n";
$np = 0;
$in = 0;
@ports = ();
foreach $k (keys %$iftable) {
unless($k =~ /^$ifindex/) {next};
$r = $$iftable{$k};
$np++;
print "Port Index $np:$r\n";
push @ports, $r;
}
@ports = sort numerically @ports;
$max_port = $ports[$#ports];
$len_port = int(log($max_port)/log(10)) + 1;
print "Max Port: $max_port $len_port\n";
}
get_dt();
open XML, ">$hostname.xml";
print XML <<EOF1;
<?xml version="1.0"?>
<zabbix_export version="1.0" date="$dt" time="$tm">
<hosts>
<host name="$hostname">
<useip>1</useip>
<ip>$hostip</ip>
<port>10050</port>
<groups>
EOF1
foreach $group (@groups) {print XML "\t\t\t\t<group>$group</group>\n"};
print XML <<EOF2;
</groups>
<items>
<item type="4" key="sysUpTimeInstance" value_typ
e="3">
<description>sysUpTime</description>
<delay>180*$slow</delay>
<history>7</history>
<trends>365</trends>
<multiplier>1</multiplier>
<formula>0.01</formula>
<units>sec</units>
<snmp_community>$cstring</snmp_community
>
<snmp_oid>.1.3.6.1.2.1.1.3.0</snmp_oid>
<snmp_port>161</snmp_port>
</item>
<item type="4" key="PowerSupply" value_type="3">
<description>PowerSupply status</descrip
tion>
<delay>180*$slow</delay>
<history>7</history>
<trends>365</trends>
<formula>1</formula>
<snmp_community>$cstring</snmp_community
>
<snmp_oid>.1.3.6.1.4.1.52.2501.1.1.4.0</
snmp_oid>
<snmp_port>161</snmp_port>
</item>
<item type="4" key="ipForwDatagrams" value_type=
"3">
<description>ipForwDatagrams - number of
packets to forward</description>
<delay>60*$slow</delay>
<history>7</history>
<trends>365</trends>
<formula>1</formula>
<units>Packet/sec</units>
<delta>1</delta>
<snmp_community>$cstring</snmp_community
>
<snmp_oid>1.3.6.1.2.1.4.6.0</snmp_oid>
<snmp_port>161</snmp_port>
</item>
<item type="4" key="ipOutNoRoutes" value_type="3
">
<description>ipOutNoRoutes - discard cau
sed no-route</description>
<delay>60*$slow</delay>
<history>7</history>
<trends>365</trends>
<formula>1</formula>
<units>Packet/sec</units>
<delta>1</delta>
<snmp_community>$cstring</snmp_community
>
<snmp_oid>1.3.6.1.2.1.4.12.0</snmp_oid>
<snmp_port>161</snmp_port>
</item>
<item type="4" key="ipInDiscards" value_type="3"
>
<description>ipInDiscards - discards on
input interfaces</description>
<delay>60*$slow</delay>
<history>7</history>
<trends>365</trends>
<formula>1</formula>
<units>Packet/sec</units>
<delta>1</delta>
<snmp_community>$cstring</snmp_community
>
<snmp_oid>1.3.6.1.2.1.4.8.0</snmp_oid>
<snmp_port>161</snmp_port>
</item>
<item type="4" key="ipOutDiscards" value_type="3
">
<description>ipOutDiscards - discards on
output interfaces</description>
<delay>60*$slow</delay>
<history>7</history>
<trends>365</trends>
<formula>1</formula>
<units>Packet/sec</units>
<delta>1</delta>
<snmp_community>$cstring</snmp_community
>
<snmp_oid>1.3.6.1.2.1.4.11.0</snmp_oid>
<snmp_port>161</snmp_port>
</item>
<item type="4" key="Cpu" value_type="3">
<description>% CPU</description>
<delay>60*$slow</delay>
<history>7</history>
<trends>365</trends>
<formula>1</formula>
<snmp_community>$cstring</snmp_community
>
<snmp_oid>.1.3.6.1.4.1.52.2501.1.270.2.1
.1.2.1</snmp_oid>
<snmp_port>161</snmp_port>
</item>
<item type="4" key="capMemorySize" value_type="3
">
<description>Memory Total</description>
<delay>3600*$slow</delay>
<history>7</history>
<trends>365</trends>
<formula>1</formula>
<units>Block</units>
<snmp_community>$cstring</snmp_community
>
<snmp_oid>.1.3.6.1.4.1.52.2501.1.270.4.1
.1.4.1.1</snmp_oid>
<snmp_port>161</snmp_port>
</item>
<item type="4" key="capMemoryBlockSize" value_ty
pe="3">
<description>Memory Block Size in Byte</
description>
<delay>3600*$slow</delay>
<history>7</history>
<trends>365</trends>
<formula>1</formula>
<units>Byte</units>
<snmp_community>$cstring</snmp_community
>
<snmp_oid>.1.3.6.1.4.1.52.2501.1.270.4.1
.1.7.1.1</snmp_oid>
<snmp_port>161</snmp_port>
</item>
<item type="4" key="capMemoryFree" value_type="3
">
<description>Memory Free</description>
<delay>300*$slow</delay>
<history>7</history>
<trends>365</trends>
<formula>1</formula>
<units>Block</units>
<snmp_community>$cstring</snmp_community
>
<snmp_oid>.1.3.6.1.4.1.52.2501.1.270.4.1
.1.5.1.1</snmp_oid>
<snmp_port>161</snmp_port>
</item>
<item type="3" key="icmpping" value_type="3">
<description>Simple_Ping</description>
<delay>60</delay>
<history>1</history>
<trends>365</trends>
<formula>1</formula>
<snmp_community>public</snmp_community>
<snmp_oid>interfaces.ifTable.ifEntry.ifI
nOctets.1</snmp_oid>
<snmp_port>161</snmp_port>
</item>
EOF2
get_ifTable();
get_ports();
foreach $port (@ports) {
$type = $$iftable{$iftype.'.'.$port};
if ($type == 1) {next};
$portdesc = $$iftable{$ifdesc.'.'.$port};
$portdesc=~s/&/&amp;/g;
if( $portdesc=~/Physical port:\s+(.+?)\s+/ || $portdesc=~/Physical port:\s+(.+?)
$/) { $portkey = $1}
else {
$portkey = $portdesc;
}
$portkey =~ s#[^a-zA-Z0-9_]#_#g;
$sport = sprintf ("%${len_port}.${len_port}d",$port);
print XML "\t\t\t\t<item type=\"4\" key=\"Port_$portkey\_Description\" value_typ
e=\"1\">\n";
print XML "\t\t\t\t\t<description>Port $sport $portdesc Description</description
>\n";
print XML "\t\t\t\t\t<delay>86400*$slow</delay>\n";
print XML "\t\t\t\t\t<history>7</history>\n";
print XML "\t\t\t\t\t<trends>365</trends>\n";
print XML "\t\t\t\t\t<formula>1</formula>\n";
print XML "\t\t\t\t\t<snmp_community>$cstring</snmp_community>\n";
print XML "\t\t\t\t\t<snmp_oid>.1.3.6.1.2.1.2.2.1.2.$port</snmp_oid>\n";
print XML "\t\t\t\t\t<snmp_port>161</snmp_port>\n";
print XML "\t\t\t\t</item>\n";
print XML "\t\t\t\t<item type=\"4\" key=\"Port_$portkey\_InOctets\" value_type=\
"3\">\n";
print XML "\t\t\t\t\t<description>Port $sport $portdesc InOctets</description>\n
";
print XML "\t\t\t\t\t<delay>60*$slow</delay>\n";
print XML "\t\t\t\t\t<history>7</history>\n";
print XML "\t\t\t\t\t<trends>365</trends>\n";
print XML "\t\t\t\t\t<units>bps</units>\n";
print XML "\t\t\t\t\t<multiplier>1</multiplier>\n";
print XML "\t\t\t\t\t<formula>8</formula>\n";
print XML "\t\t\t\t\t<delta>1</delta>\n";
print XML "\t\t\t\t\t<snmp_community>$cstring</snmp_community>\n";
print XML "\t\t\t\t\t<snmp_oid>.1.3.6.1.2.1.2.2.1.10.$port</snmp_oid>\n";
print XML "\t\t\t\t\t<snmp_port>161</snmp_port>\n";
print XML "\t\t\t\t</item>\n";
print XML "\t\t\t\t<item type=\"4\" key=\"Port_$portkey\_InErrors\" value_type=\
"3\">\n";
print XML "\t\t\t\t\t<description>Port $sport $portdesc InErrors</description>\n
";
print XML "\t\t\t\t\t<delay>3600*$slow</delay>\n";
print XML "\t\t\t\t\t<history>7</history>\n";
print XML "\t\t\t\t\t<trends>365</trends>\n";
print XML "\t\t\t\t\t<delta>2</delta>\n";
print XML "\t\t\t\t\t<snmp_community>$cstring</snmp_community>\n";
print XML "\t\t\t\t\t<snmp_oid>.1.3.6.1.2.1.2.2.1.14.$port</snmp_oid>\n";
print XML "\t\t\t\t\t<snmp_port>161</snmp_port>\n";
print XML "\t\t\t\t</item>\n";
print XML "\t\t\t\t<item type=\"4\" key=\"Port_$portkey\_OutOctets\" value_type=
\"3\">\n";
print XML "\t\t\t\t\t<description>Port $sport $portdesc OutOctets</description>\
n";
print XML "\t\t\t\t\t<delay>60*$slow</delay>\n";
print XML "\t\t\t\t\t<history>7</history>\n";
print XML "\t\t\t\t\t<trends>365</trends>\n";
print XML "\t\t\t\t\t<units>bps</units>\n";
print XML "\t\t\t\t\t<delta>1</delta>\n";
print XML "\t\t\t\t\t<multiplier>1</multiplier>\n";
print XML "\t\t\t\t\t<formula>8</formula>\n";
print XML "\t\t\t\t\t<snmp_community>$cstring</snmp_community>\n";
print XML "\t\t\t\t\t<snmp_oid>.1.3.6.1.2.1.2.2.1.16.$port</snmp_oid>\n";
print XML "\t\t\t\t\t<snmp_port>161</snmp_port>\n";
print XML "\t\t\t\t</item>\n";
print XML "\t\t\t\t<item type=\"4\" key=\"Port_$portkey\_OutErrors\" value_type=
\"3\">\n";
print XML "\t\t\t\t\t<description>Port $sport $portdesc OutErrors</description>\
n";
print XML "\t\t\t\t\t<delay>3600*$slow</delay>\n";
print XML "\t\t\t\t\t<history>7</history>\n";
print XML "\t\t\t\t\t<trends>365</trends>\n";
print XML "\t\t\t\t\t<delta>2</delta>\n";
print XML "\t\t\t\t\t<snmp_community>$cstring</snmp_community>\n";
print XML "\t\t\t\t\t<snmp_oid>.1.3.6.1.2.1.2.2.1.20.$port</snmp_oid>\n";
print XML "\t\t\t\t\t<snmp_port>161</snmp_port>\n";
print XML "\t\t\t\t</item>\n";
print XML "\t\t\t\t<item type=\"4\" key=\"Port_$portkey\_Speed\" value_type=\"3\
">\n";
print XML "\t\t\t\t\t<description>Port $sport $portdesc Speed</description>\n";
print XML "\t\t\t\t\t<delay>3600*$slow</delay>\n";
print XML "\t\t\t\t\t<history>7</history>\n";
print XML "\t\t\t\t\t<trends>365</trends>\n";
print XML "\t\t\t\t\t<units>bps</units>\n";
print XML "\t\t\t\t\t<formula>1</formula>\n";
print XML "\t\t\t\t\t<snmp_community>$cstring</snmp_community>\n";
print XML "\t\t\t\t\t<snmp_oid>.1.3.6.1.2.1.2.2.1.5.$port</snmp_oid>\n";
print XML "\t\t\t\t\t<snmp_port>161</snmp_port>\n";
print XML "\t\t\t\t</item>\n";
print XML "\t\t\t\t<item type=\"4\" key=\"Port_$portkey\_State\" value_type=\"3\
">\n";
print XML "\t\t\t\t\t<description>Port $sport $portdesc State</description>\n";
print XML "\t\t\t\t\t<delay>600*$slow</delay>\n";
print XML "\t\t\t\t\t<history>7</history>\n";
print XML "\t\t\t\t\t<trends>365</trends>\n";
print XML "\t\t\t\t\t<formula>1</formula>\n";
print XML "\t\t\t\t\t<valuemap>Port Status</valuemap>\n";
print XML "\t\t\t\t\t<snmp_community>$cstring</snmp_community>\n";
print XML "\t\t\t\t\t<snmp_oid>.1.3.6.1.2.1.2.2.1.8.$port</snmp_oid>\n";
print XML "\t\t\t\t\t<snmp_port>161</snmp_port>\n";
print XML "\t\t\t\t</item>\n";
print XML "\t\t\t\t<item type=\"4\" key=\"Port_$portkey\_State_Admin\" value_typ
e=\"3\">\n";
print XML "\t\t\t\t\t<description>Port $sport $portdesc State (Admin)</descripti
on>\n";
print XML "\t\t\t\t\t<delay>600*$slow</delay>\n";
print XML "\t\t\t\t\t<history>7</history>\n";
print XML "\t\t\t\t\t<trends>365</trends>\n";
print XML "\t\t\t\t\t<formula>1</formula>\n";
print XML "\t\t\t\t\t<valuemap>Port Status</valuemap>\n";
print XML "\t\t\t\t\t<snmp_community>$cstring</snmp_community>\n";
print XML "\t\t\t\t\t<snmp_oid>.1.3.6.1.2.1.2.2.1.7.$port</snmp_oid>\n";
print XML "\t\t\t\t\t<snmp_port>161</snmp_port>\n";
print XML "\t\t\t\t</item>\n";
}
print XML "\t\t\t</items>\n";
print XML "\t\t\t<triggers>\n";
$fact = $ptpct/100;
foreach $port (@ports) {
$sport = sprintf ("%3.3d",$port);
$portdesc = $$iftable{$ifdesc.'.'.$port};
$portdesc=~s/&/&amp;/g;
$speed = $$iftable{$ifspeed.'.'.$port};
$cspeed = $ptpct*$speed/100;
if( $portdesc=~/Physical port:\s+(.+?)\s+/ || $portdesc=~/Physical port:
\s+(.+?)$/) { $portkey = $1}
else {
$portkey = $portdesc;
}
$portkey =~ s#[^a-zA-Z0-9_]#_#g;
if ($ptpct != 0 ){
if ($speed!=0) {
print XML "\t\t\t\t<trigger>\n";
print XML "\t\t\t\t\t<description>Port $sport $portdesc InOctets Thresho
ld Exceeded</description>\n";
print XML "\t\t\t\t\t<expression>{{HOSTNAME}:Port_$portkey\_InOctets.min
(#4)}&gt;$fact*{{HOSTNAME}:Port_$portkey\_Speed.max(#2)} &amp; {{HOSTNAME}:Port_
$portkey\_Speed.max(#2)}#0</expression>\n";
print XML "\t\t\t\t\t<priority>4</priority>\n";
print XML "\t\t\t\t\t<status>0</status>\n";
print XML "\t\t\t\t\t<comments>
Port speed $speed bps
Threshold = $ptpct\%
</comments>\n";
print XML "\t\t\t\t</trigger>\n";
print XML "\t\t\t\t<trigger>\n";
print XML "\t\t\t\t\t<description>Port $sport $portdesc InErrors on Inte
rface </description>\n";
print XML "\t\t\t\t\t<expression>{{HOSTNAME}:Port_$portkey\_InErrors.las
t(0)}&gt;0</expression>\n";
print XML "\t\t\t\t\t<priority>1</priority>\n";
print XML "\t\t\t\t\t<status>0</status>\n";
print XML "\t\t\t\t\t<comments>
InErrors on interface
</comments>\n";
print XML "\t\t\t\t</trigger>\n";
print XML "\t\t\t\t<trigger>\n";
print XML "\t\t\t\t\t<description>Port $sport $portdesc OutOctets Thresh
old Exceeded</description>\n";
print XML "\t\t\t\t\t<expression>{{HOSTNAME}:Port_$portkey\_OutOctets.mi
n(#4)}&gt;$fact*{{HOSTNAME}:Port_$portkey\_Speed.max(#2)} &amp; {{HOSTNAME}:Port
_$portkey\_Speed.max(#2)}#0</expression>\n";
print XML "\t\t\t\t\t<priority>4</priority>\n";
print XML "\t\t\t\t\t<status>0</status>\n";
print XML "\t\t\t\t\t<comments>Port speed $speed bps</comments>\n";
print XML "\t\t\t\t</trigger>\n";
print XML "\t\t\t\t<trigger>\n";
print XML "\t\t\t\t\t<description>Port $sport $portdesc OutErrors on Int
erface </description>\n";
print XML "\t\t\t\t\t<expression>{{HOSTNAME}:Port_$portkey\_OutErrors.la
st(0)}&gt;0</expression>\n";
print XML "\t\t\t\t\t<priority>1</priority>\n";
print XML "\t\t\t\t\t<status>0</status>\n";
print XML "\t\t\t\t\t<comments>
OutErrors on interface
</comments>\n";
print XML "\t\t\t\t</trigger>\n";
}
print XML "\t\t\t\t<trigger>\n";
print XML "\t\t\t\t\t<description>Port $sport $portdesc administrative s
tatus has changed</description>\n";
print XML "\t\t\t\t\t<expression>{{HOSTNAME}:Port_$portkey\_State_Admin.
delta(#2)}#0</expression>\n";
print XML "\t\t\t\t\t<priority>1</priority>\n";
print XML "\t\t\t\t\t<status>0</status>\n";
print XML "\t\t\t\t</trigger>\n";
}
print XML "\t\t\t\t<trigger>\n";
print XML "\t\t\t\t\t<description>Port $sport $portdesc status has chang
ed</description>\n";
print XML "\t\t\t\t\t<expression>{{HOSTNAME}:Port_$portkey\_State.delta(
#2)}#0</expression>\n";
print XML "\t\t\t\t\t<priority>1</priority>\n";
print XML "\t\t\t\t\t<status>0</status>\n";
print XML "\t\t\t\t</trigger>\n";
}
$mem_fact=$mem_ptpct/100;
print XML <<EOF3;
<trigger>
<description>{HOSTNAME} CPU Over $ptpct
%</description>
<expression>{{HOSTNAME}:Cpu.min(90)}&gt;
$ptpct</expression>
<priority>4</priority>
<status>0</status>
<comments>{HOSTNAME} has had a CPU Utili
zation above $ptpct% for 3 samples taken in the last 1 minute 30 seconds.</comme
nts>
</trigger>
<trigger>
<description>{HOSTNAME} SNMP Failed</des
cription>
<expression>{{HOSTNAME}:Cpu.nodata(14400
)}=1</expression>
<priority>4</priority>
<status>0</status>
<comments>{HOSTNAME} SNMP Failed. Check
configuration, ACL.</comments>
</trigger>
<trigger>
<description>Memory Free &lt; $mem_ptpct
%</description>
<type>0</type>
<expression>{{HOSTNAME}:capMemoryFree.mi
n(10)}/{{HOSTNAME}:capMemorySize.last(0)}&lt; $mem_fact</expression>
<url></url>
<status>0</status>
<priority>3</priority>
<comments>Memory Free &lt; $mem_ptpct %<
/comments>
</trigger>
<trigger>
<description>{HOSTNAME} is Unreachable</
description>
<expression>{{HOSTNAME}:icmpping.max(90)
}=0</expression>
<priority>4</priority>
<status>0</status>
<comments>Can not Ping {HOSTNAME} 3 time
s in last 1 minute 30</comments>
</trigger>
<trigger>
<description>{HOSTNAME} reloaded</descri
ption>
<expression>{{HOSTNAME}:sysUpTimeInstanc
e.last(0)}&lt;720*$slow</expression>
<priority>2</priority>
<status>0</status>
<comments>{HOSTNAME} reloaded</comments
>
</trigger>
<trigger>
<description>{HOSTNAME} PowerSupply Fail
ed</description>
<expression>{{HOSTNAME}:PowerSupply.last
(0)}#15</expression>
<priority>2</priority>
<status>0</status>
<comments>{HOSTNAME} PowerSupply Failed<
/comments>
</trigger>
EOF3
print XML "\t\t\t</triggers>\n";
print XML "\t\t\t<graphs>\n";
foreach $port (@ports) {
$type = $$iftable{$iftype.'.'.$port};
if ($type == 1) {next};
$portdesc = $$iftable{$ifdesc.'.'.$port};
$portdesc=~s/&/&amp;/g;
if( $portdesc=~/Physical port:\s+(.+?)\s+/ || $portdesc=~/Physical port:\s+(.+?)
$/) { $portkey = $1}
else {
$portkey = $portdesc;
}
$portkey =~ s#[^a-zA-Z0-9_]#_#g;
$sport = sprintf ("%${len_port}.${len_port}d",$port);
print XML "\t\t\t\t<graph name=\"Port $sport $portdesc\" width=\"900\" height=\"
400\">\n";
print XML <<EOF4;
<yaxistype>0</yaxistype>
<show_work_period>0</show_work_period>
<show_triggers>0</show_triggers>
<graphtype>0</graphtype>
<ymin_type>1</ymin_type>
<ymax_type>0</ymax_type>
<ymin_item_key></ymin_item_key>
<ymax_item_key></ymax_item_key>
<yaxismin>0.0000</yaxismin>
<yaxismax>100.0000</yaxismax>
<show_legend>0</show_legend>
<show_3d>0</show_3d>
<percent_left>0.0000</percent_left>
<percent_right>0.0000</percent_right>
<graph_elements>
EOF4
print XML "\t\t\t\t\t\t<graph_element item=\"{HOSTNAME}:Port_$portkey\_OutOctets
\">\n";
print XML <<EOF5;
<drawtype>1</drawtype>
<sortorder>0</sortorder>
<color>009900</color>
<yaxisside>0</yaxisside>
<calc_fnc>4</calc_fnc>
<type>0</type>
<periods_cnt>5</periods_
cnt>
</graph_element>
EOF5
print XML "\t\t\t\t\t\t<graph_element item=\"{HOSTNAME}:Port_$portkey\_InOctets\
">\n";
print XML <<EOF6;
<drawtype>2</drawtype>
<sortorder>0</sortorder>
<color>000099</color>
<yaxisside>0</yaxisside>
<calc_fnc>4</calc_fnc>
<type>0</type>
<periods_cnt>5</periods_
cnt>
</graph_element>
</graph_elements>
</graph>
EOF6
}
print XML <<EOF7;
<graph name="[RouterPerformance] - Total forward
ed/dropped packets" width="900" height="400">
<yaxistype>2</yaxistype>
<show_work_period>0</show_work_period>
<show_triggers>0</show_triggers>
<graphtype>0</graphtype>
<ymin_type>1</ymin_type>
<ymax_type>0</ymax_type>
<ymin_item_key></ymin_item_key>
<ymax_item_key></ymax_item_key>
<yaxismin>0.0000</yaxismin>
<yaxismax>100.0000</yaxismax>
<show_legend>0</show_legend>
<show_3d>0</show_3d>
<percent_left>0.0000</percent_left>
<percent_right>0.0000</percent_right>
<graph_elements>
<graph_element item="{HOSTNAME}:
ipForwDatagrams">
<drawtype>5</drawtype>
<sortorder>0</sortorder>
<color>009900</color>
<yaxisside>0</yaxisside>
<calc_fnc>2</calc_fnc>
<type>0</type>
<periods_cnt>5</periods_
cnt>
</graph_element>
<graph_element item="{HO
STNAME}:ipInDiscards">
<drawtype>5</drawtype>
<sortorder>0</sortorder>
<color>990000</color>
<yaxisside>0</yaxisside>
<calc_fnc>2</calc_fnc>
<type>0</type>
<periods_cnt>5</periods_
cnt>
</graph_element>
<graph_element item="{HOSTNAME}:
ipOutDiscards">
<drawtype>5</drawtype>
<sortorder>0</sortorder>
<color>990099</color>
<yaxisside>0</yaxisside>
<calc_fnc>2</calc_fnc>
<type>0</type>
<periods_cnt>5</periods_
cnt>
</graph_element>
<graph_element item="{HOSTNAME}:
ipOutNoRoutes">
<drawtype>5</drawtype>
<sortorder>0</sortorder>
<color>FFFF00</color>
<yaxisside>0</yaxisside>
<calc_fnc>2</calc_fnc>
<type>0</type>
<periods_cnt>5</periods_
cnt>
</graph_element>
</graph_elements>
</graph>
<graph name="CPU LOAD %" width="900" height="400
">
<yaxistype>2</yaxistype>
<show_work_period>0</show_work_period>
<show_triggers>0</show_triggers>
<graphtype>0</graphtype>
<ymin_type>1</ymin_type>
<ymax_type>0</ymax_type>
<ymin_item_key></ymin_item_key>
<ymax_item_key></ymax_item_key>
<yaxismin>0.0000</yaxismin>
<yaxismax>100.0000</yaxismax>
<show_legend>0</show_legend>
<show_3d>0</show_3d>
<percent_left>0.0000</percent_left>
<percent_right>0.0000</percent_right>
<graph_elements>
<graph_element item="{HOSTNAME}:
Cpu">
<drawtype>0</drawtype>
<sortorder>0</sortorder>
<color>009900</color>
<yaxisside>0</yaxisside>
<calc_fnc>2</calc_fnc>
<type>0</type>
<periods_cnt>5</periods_
cnt>
</graph_element>
</graph_elements>
</graph>
<graph name="Memory" width="900" height="400">
<yaxistype>2</yaxistype>
<show_work_period>0</show_work_period>
<show_triggers>1</show_triggers>
<graphtype>0</graphtype>
<ymin_type>1</ymin_type>
<ymax_type>0</ymax_type>
<ymin_item_key></ymin_item_key>
<ymax_item_key></ymax_item_key>
<yaxismin>0.0000</yaxismin>
<yaxismax>100.0000</yaxismax>
<show_legend>0</show_legend>
<show_3d>0</show_3d>
<percent_left>0.0000</percent_left>
<percent_right>0.0000</percent_right>
<graph_elements>
<graph_element item="{HOSTNAME}:
capMemorySize">
<drawtype>0</drawtype>
<sortorder>0</sortorder>
<color>FF0000</color>
<yaxisside>0</yaxisside>
<calc_fnc>2</calc_fnc>
<type>0</type>
<periods_cnt>5</periods_
cnt>
</graph_element>
<graph_element item="{HOSTNAME}:
capMemoryFree">
<drawtype>0</drawtype>
<sortorder>0</sortorder>
<color>009900</color>
<yaxisside>0</yaxisside>
<calc_fnc>2</calc_fnc>
<type>0</type>
<periods_cnt>5</periods_
cnt>
</graph_element>
</graph_elements>
</graph>
EOF7
print XML "\t\t\t</graphs>\n";
print XML "\t\t</host>\n";
print XML "\t</hosts>\n";
print XML "</zabbix_export>\n";
close XML;
exit;