Skip to content

Commit

Permalink
added nagiosxi as grapher solution
Browse files Browse the repository at this point in the history
  • Loading branch information
Tontonitch committed Oct 7, 2014
1 parent 9a3a9ea commit 231c379
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions libexec/check_interface_table_v3t.pl.in
Original file line number Diff line number Diff line change
Expand Up @@ -5179,6 +5179,10 @@ sub GenerateInterfaceTableData {
$ghOptions{'grapherurl'} . '/?host=' . $ghOptions{'hostdisplay'} . '&service=' . $servicename . '::check_interface_table_port">' .
'<img src="../img/chart.png" alt="Trends" /></a>';
}
} elsif ($ghOptions{'grapher'} eq "nagiosxi") {
$CellContent .= '<a href="' .
$ghOptions{'grapherurl'} . '/?host=' . $ghOptions{'hostdisplay'} . '&service=' . $servicename . '">' .
'<img src="../img/chart.png" alt="Trends" /></a>';
}
}
# Retrieve detailed interface info via snmp link
Expand Down Expand Up @@ -5538,7 +5542,7 @@ sub WriteHtmlFile {
# Perfdataout
# --------------------------------------------------------------------
# Description: write performance data
# Grapher: pnp4nagios, nagiosgrapher, netwaysgrapherv2, ingraph
# Grapher: pnp4nagios, nagiosgrapher, netwaysgrapherv2, ingraph, nagiosxi
# Format:
# * full : generated performance data include plugin related stats,
# interface status, interface load stats, and packet error stats
Expand All @@ -5548,8 +5552,8 @@ sub WriteHtmlFile {
# ------------------------------------------------------------------------
sub Perfdataout {

#------ Pnp4nagios, Netwaysgrapherv2, ingraph ------#
if (( $ghOptions{'grapher'} eq "pnp4nagios" ) || ( $ghOptions{'grapher'} eq "ingraph" )) {
#------ Pnp4nagios, Netwaysgrapherv2, ingraph, nagiosxi ------#
if (( $ghOptions{'grapher'} eq "pnp4nagios" ) || ( $ghOptions{'grapher'} eq "ingraph" ) || ( $ghOptions{'grapher'} eq "nagiosxi" )) {

# plugin related stats
$gPerfdata .= "Interface_global::check_interface_table_global::".
Expand Down Expand Up @@ -6537,7 +6541,7 @@ sub print_usage () {
macros are enabled in nagios.cfg/icinga.cfg
-g, --grapher (optional)
Specify the used graphing solution.
Can be pnp4nagios, nagiosgrapher, netwaysgrapherv2, ingraph or graphite.
Can be pnp4nagios, nagiosgrapher, netwaysgrapherv2, ingraph, graphite or nagiosxi.
--grapherurl (optional)
Graphing system url. Default values are:
Ex: /pnp4nagios
Expand Down Expand Up @@ -6732,7 +6736,7 @@ sub check_options () {
'perfdatathreshold=s', # define which thresholds should be printed in the generated performance data.
'perfdatadir=s', # where to write perfdata files directly for netways nagios grapher v1
'perfdataservicedesc=s', # servicedescription in Nagios/Icinga so that PNP uses the correct name for its files
'grapher|g=s', # graphing system. Can be pnp4nagios, nagiosgrapher, netwaysgrapherv2, ingraph or graphite
'grapher|g=s', # graphing system. Can be pnp4nagios, nagiosgrapher, netwaysgrapherv2, ingraph, graphite, nagiosxi
'grapherurl=s', # graphing system url. By default, this is adapted for pnp4nagios standard install: /pnp4nagios
#-------- SNMP related ----------#
'host=s', # SNMP host target
Expand Down Expand Up @@ -7127,15 +7131,17 @@ sub check_options () {

#------- performance data -------#
if (exists $commandline{grapher}) {
if ($commandline{grapher} =~ /^pnp4nagios$|^nagiosgrapher$|^netwaysgrapherv2$|^ingraph$|^graphite$/i) {
if ($commandline{grapher} =~ /^pnp4nagios$|^nagiosgrapher$|^netwaysgrapherv2$|^ingraph$|^graphite$|^nagiosxi$/i) {
$ghOptions{'grapher'} = "$commandline{grapher}";
if ($ghOptions{'grapher'} eq "pnp4nagios") {
$ghOptions{'grapherurl'} = "/pnp4nagios";
} elsif ($ghOptions{'grapher'} eq "ingraph") {
$ghOptions{'grapherurl'} = "/ingraph";
} elsif ($ghOptions{'grapher'} eq "nagiosxi") {
$ghOptions{'grapherurl'} = "/nagiosxi/perfgraphs";
}
} else {
print "Specified grapher solution \"$commandline{grapher}\" is not valid. Valid graphers are: pnp4nagios, nagiosgrapher, netwaysgrapherv2, ingraph, graphite.\n";
print "Specified grapher solution \"$commandline{grapher}\" is not valid. Valid graphers are: pnp4nagios, nagiosgrapher, netwaysgrapherv2, ingraph, graphite, nagiosxi.\n";
exit $ERRORS{"UNKNOWN"};
}
}
Expand Down

0 comments on commit 231c379

Please sign in to comment.