Hi Andreas,
 
thank you for the comprehensive list - that was super helpful! I used it to write two new check plugins this morning.
 
Best,
Marcel
 
Gesendet: Mittwoch, 05. Juni 2019 um 18:16 Uhr
Von: "Andreas Maus" <goldloeckc...@ypbind.de>
An: "Icinga Users" <icinga-users@lists.icinga.org>
Betreff: Re: [icinga-users] Check network interfaces without SNMP
Good day.

Some nitpicking ;)

ifconfig is deprecated was replaced by ip.

Depending on your configuration a system under very heavy
memory pressure may timeout executing external programms,
so reading files from the in memory sysfs may be a better choice.

If you are only Linux (no HP-UX, AIX, Solaris, etc.) all
information can also be found in files in the sysfs mount (usually
/sys) in /sys/class/net/<device>

Link state: /sys/class/net/operstate
Negotiated/configured link speed: /sys/class/net/speed
Negotiated/configured duplex mode: /sys/class/net/duplex
MTU: /sys/class/net/mtu

Error/drop and other counters are in the corresponding files
in /sys/class/net/<device>/statistics/

Note: those are 64 bit _counter_ values, if you want the rate
you have to keep the previous value, calculate the difference
and check for counter overflows.

If you have non-Ethernet network interfaces the kernel also provides
similar information in /sys/class, e.g. for Infinband devices
in /sys/class/infiniband/<hca>/ports/<port>

or FibreChannel devices in /sys/class/fc_host/ /sys/class/fc_vports/ and
/sys/class/fc_remote_ports/

Obviously all commands must be executed on the client (assuming
Icinga2).

My 2 euro cents.

So long,

Andreas.

On Wed Jun 05, 2019 at 15:52:46PM +0000, Ivo Kidze wrote:
> Hi Simon,
>
> A small plugin script on the client could reduce hair loss. I have scribbled a small solution for up/down. You can adapt it for link speed, rx, tx, crc errors etc.
>
> Usage: sh check_interface_state.sh eth0
>
> #!/bin/bash
>
> state=$(/sbin/ifconfig -a | grep $1 | awk 'BEGIN{FS="<"; RS=","}{print $2; exit}')
>
> #echo "$state"
> if [ ! -z "$state" ]; then
> if (($state == "UP")); then
> echo "OK - interface $1 is UP"
> exit 0
> else
> echo "CRITICAL - interface $1 is DOWN"
> exit 2
> fi
> else
> echo "CRITICAL - interface $1 is DOWN"
> exit 2
> fi
>
> You make improve the script to serve your needs.
>
> Kind Regards,
> Ivo Kidze
>
> From: icinga-users [mailto:icinga-users-boun...@lists.icinga.org] On Behalf Of Mueller, Simon
> Sent: Wednesday, June 5, 2019 6:00 AM
> To: icinga-users@lists.icinga.org
> Subject: [icinga-users] Check network interfaces without SNMP
>
> Hello Community,
>
> we are searching for a possibility to check network interfaces (up/down, link speed, rx, tx, crc errors, etc.) without going through the hassle to configure snmpd on each client that we are monitoring. The plugin that we are searching for most likely will use information from ethtool/mii-tool/ifconfig/ip commands which are normally existent on every client by default or could easily be added to kickstart/configmgmt.
>
> Until now we couldn't find anything proper on Icinga Exchange or on the net, maybe you guys have an idea?
>
>
> Best regards,
>
> Simon Müller
> Consultant
> Bechtle GmbH & Co. KG
> Besselstraße 20-22, DE-68219 Mannheim
>
> Phone: +49 621 87503 140
>
> E-Mail: simon.muel...@bechtle.com<mailto:simon.muel...@bechtle.com>
> Video: JabberGuest<https://urldefense.proofpoint.com/v2/url?u=https-3A__jabberguest.bechtle.com_call_simon.mueller-40bechtle.com&d=DwMFAw&c=imBPVzF25OnBgGmVOlcsiEgHoG1i6YHLR0Sj_gZ4adc&r=dLhm7TMuuUAhZaaelXPoEPyMbTqxkar-G5Ayny5-yLE&m=mU7-XpgHkAnSHJNcZ0qlfG0HAeBjim8pWsTcjIxbUDo&s=Rn5U0_dEUrxdNKqeeq8u1Gq-UDd0ZHALl5idRBQuhrI&e=>
> Web: bechtle.com<https://urldefense.proofpoint.com/v2/url?u=https-3A__bechtle.com&d=DwMFAw&c=imBPVzF25OnBgGmVOlcsiEgHoG1i6YHLR0Sj_gZ4adc&r=dLhm7TMuuUAhZaaelXPoEPyMbTqxkar-G5Ayny5-yLE&m=mU7-XpgHkAnSHJNcZ0qlfG0HAeBjim8pWsTcjIxbUDo&s=LNcCiD7DnqHeXBkf2imLtdyWtTRapzkax85tSuiF7lM&e=>
> DSGVO/GDPR: Privacy Policy Art. 13,14<https://urldefense.proofpoint.com/v2/url?u=https-3A__www.bechtle.com_privacy-2Dpolicy&d=DwMFAw&c=imBPVzF25OnBgGmVOlcsiEgHoG1i6YHLR0Sj_gZ4adc&r=dLhm7TMuuUAhZaaelXPoEPyMbTqxkar-G5Ayny5-yLE&m=mU7-XpgHkAnSHJNcZ0qlfG0HAeBjim8pWsTcjIxbUDo&s=GGnjmyFyWO9XiTq2GBE0W9FCJtNrgM8UyEQGxXumU4Y&e=>
>
> Sitz Mannheim, Amtsgericht Mannheim, HRA 4577, Geschäftsführende Gesellschafterin MA Bechtle Verwaltungs-GmbH, Sitz Mannheim, Amtsgericht Mannheim HRB 8671, Ust-Id.Nr. DE813141515, Geschäftsführer: Stephan Mauer
>
>

> _______________________________________________
> icinga-users mailing list
> icinga-users@lists.icinga.org
> https://lists.icinga.org/mailman/listinfo/icinga-users


--
"Things that try to look like things often do
look more like things than things. Well-known fact."
Granny Weatherwax - "Wyrd sisters"
_______________________________________________
icinga-users mailing list
icinga-users@lists.icinga.org
https://lists.icinga.org/mailman/listinfo/icinga-users
_______________________________________________
icinga-users mailing list
icinga-users@lists.icinga.org
https://lists.icinga.org/mailman/listinfo/icinga-users

Reply via email to