<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Sysmo NMS Network Management and Monitoring solution (http://www.sysmo.io)
  ~
  ~ Copyright (c) 2012-2015 Sebastien Serre <ssbx@sysmo.io>
  ~
  ~ This file is part of Sysmo NMS.
  ~
  ~ Sysmo NMS is free software: you can redistribute it and/or modify
  ~ it under the terms of the GNU General Public License as published by
  ~ the Free Software Foundation, either version 3 of the License, or
  ~ (at your option) any later version.
  ~
  ~ Sysmo NMS is distributed in the hope that it will be useful,
  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  ~ GNU General Public License for more details.
  ~
  ~ You should have received a copy of the GNU General Public License
  ~ along with Sysmo.  If not, see <http://www.gnu.org/licenses/>.
  -->

<NChecks xmlns="http://schemas.sysmo.io/2015/NChecks">
    <Check
        Id="io.sysmo.nchecks.CheckICMP"
        Version="1.0"
        Class="io.sysmo.nchecks.checks.CheckICMP">

        <Author><![CDATA[Sebastien Serre (ssbx@sysmo.io)]]></Author>
        <AuthorUrl>http://www.sysmo.io</AuthorUrl>
        <UpdatesUrl>http://www.sysmo.io/nchecks/updates/CheckICMP</UpdatesUrl>

        <Description>Check host presence using ICMP echo request</Description>
        <Overview>Overview and examples here.</Overview>


        <FlagTable>
            <Flag Id="host">
                <Hint>Host or IP</Hint>
                <Usage>Host target as ip version 4/6 or hostname</Usage>
            </Flag>
            <!--
            <Flag Id="pkts_number">
                <Default>5</Default>
                <Hint>packets number</Hint>
                <Usage>Number of packets to send</Usage>
            </Flag>
            <Flag Id="pkts_size">
                <Default>56</Default>
                <Hint>Octets</Hint>
                <Usage>Size of the ICMP body in octets</Usage>
            </Flag>
            -->
            <Flag Id="pl_warning">
                <Default>50</Default>
                <Hint>Milliseconds</Hint>
                <Usage>Packet lost CRITICAL threshold in percent. Will return a status WARNING when packet lost exceed the value</Usage>
            </Flag>
            <Flag Id="pl_critical">
                <Default>99</Default>
                <Hint>Milliseconds</Hint>
                <Usage>Packet lost CRITICAL threshold in percent. Will return a status CRITICAL when packet lost exceed the value</Usage>
            </Flag>
            <Flag Id="ms_warning">
                <Default>200</Default>
                <Hint>Milliseconds</Hint>
                <Usage>Echo/Reply latency WARNING threshold. Will return a status WARNING if average reply time exceed the value</Usage>
            </Flag>
            <Flag Id="ms_critical">
                <Default>200</Default>
                <Hint>Milliseconds</Hint>
                <Usage>Echo/Reply latency CRITICAL threshold. Will return a status CRITICAL if average reply time exceed the value</Usage>
            </Flag>
            <Flag Id="ms_timeout">
                <Default>5000</Default>
                <Hint>Milliseconds</Hint>
                <Usage>Stop waiting reply or refuse reply when it exceed the value</Usage>
            </Flag>
            <!--
            <Flag Id="ms_interval">
                <Default>100</Default>
                <Hint>Milliseconds</Hint>
                <Usage>Interval in milliseconds between request packets</Usage>
            </Flag>
            -->
            <!--
            <Flag Id="use_ipv6">
                <Default>false</Default>
                <Hint>"true" or "false"</Hint>
                <Usage>Force use of the v6 address. Usefull if host arg is an hostname</Usage>
            </Flag>
            -->
        </FlagTable>


        <Performances Type="simple" >
            <FileName>CheckICMP.rrd</FileName>
            <DataSourceTable>
                <DataSource Id="MinRoundTrip"       Type="GAUGE" />
                <DataSource Id="MaxRoundTrip"       Type="GAUGE" />
                <DataSource Id="AverageRoundTrip"   Type="GAUGE" />
                <DataSource Id="PercentLost"        Type="GAUGE" />
            </DataSourceTable>
            <GraphTable>
                <Graph
                    Id="ICMPPerfs"
                    Minimum="0"
                    Maximum=""
                    Rigid="false"
                    Base="1000"
                    Unit="ms"
                    UnitExponent="0" >
                    <Title>ICMP Performances</Title>
                    <VerticalLabel>Milliseconds</VerticalLabel>
                    <Draw
                        Type="area"
                        DataSource="MaxRoundTrip"
                        Consolidation="MAX"
                        Color="#204A87AA" >
                        Maximum round trip
                    </Draw>
                    <Draw
                        Type="area"
                        DataSource="MinRoundTrip"
                        Consolidation="MAX"
                        Color="#20ff87AA" >
                        Minimum round trip
                    </Draw>
                    <Draw
                        Type="area"
                        DataSource="AverageRoundTrip"
                        Consolidation="MAX"
                        Color="#ff4A87AA" >
                        Average round trip
                    </Draw>
                </Graph>
                <Graph
                    Id="ICMPPercentsLost"
                    Minimum="0"
                    Maximum="100"
                    Rigid="true"
                    Base="1000"
                    Unit="%"
                    UnitExponent="0" >
                    <Title>ICMP replies lost</Title>
                    <VerticalLabel>Percent</VerticalLabel>
                    <Draw
                        Type="area"
                        DataSource="PercentLost"
                        Consolidation="MAX"
                        Color="#ec9d48ff" />
                    <Draw
                        Type="area"
                        DataSource="PercentLost"
                        Consolidation="AVERAGE"
                        Color="#ecd748ff" />
                    <Draw
                        Type="line"
                        DataSource="PercentLost"
                        Consolidation="MAX"
                        Color="#cc7016ff" >
                        Maximum Percent packets lost
                    </Draw>
                    <Draw
                        Type="line"
                        DataSource="PercentLost"
                        Consolidation="AVERAGE"
                        Color="#c9b215ff" >
                        Average Percent Packets Lost
                    </Draw>
                </Graph>
            </GraphTable>
        </Performances>
    </Check>
</NChecks>
