Check_dhcp

zGreenfelder zgreenfelder at gmail.com
Sun Mar 11 07:55:37 CET 2018


On Sat, Mar 10, 2018 at 4:16 AM, Amin Djema <adjema at lunerouge.com> wrote:
> Hi,
>
>
>
> Using Nagios for the first time and trying to configure the check_dhcp
> plugin » Is it possible to specify from what vlan i’m asking an ip address ?
>
>
>
> Thanks
>

the short answer is almost always 'sort of.   depending on what level
you're willing to go to'

if you check the help output -

[root at euler plugins]# ./check_dhcp  -h
check_dhcp v2.2.1 (nagios-plugins 2.2.1)
Copyright (c) 2001-2004 Ethan Galstad (nagios at nagios.org)
Copyright (c) 2001-2007 Nagios Plugin Development Team
        <devel at nagios-plugins.org>

This plugin tests the availability of DHCP servers on a network.


Usage:
 check_dhcp [-v] [-u] [-s serverip] [-r requestedip] [-t timeout]
                  [-i interface] [-m mac]

Options:
 -h, --help
    Print detailed help screen
 -V, --version
    Print version information
 --extra-opts=[section][@file]
    Read options from an ini file. See
    https://www.nagios-plugins.org/doc/extra-opts.html
    for usage and examples.
 -v, --verbose
    Show details for command-line debugging (Nagios may truncate output)
 -s, --serverip=IPADDRESS
    IP address of DHCP server that we must hear from
 -r, --requestedip=IPADDRESS
    IP address that should be offered by at least one DHCP server
 -t, --timeout=INTEGER
    Seconds to wait for DHCPOFFER before timeout occurs
 -i, --interface=STRING
    Interface to to use for listening (i.e. eth0)
 -m, --mac=STRING
    MAC address to use in the DHCP request
 -u, --unicast
    Unicast testing: mimic a DHCP relay, requires -s

Send email to help at nagios-plugins.org if you have questions regarding use
of this software. To submit patches or suggest improvements, send email to
devel at nagios-plugins.org



so clearly there's no option for a vlan through that route, but if you
google about your preferred OS and vlan tagging, you might find
something like
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/networking_guide/sec-configure_802_1q_vlan_tagging_using_the_command_line

and from that page specifically:
----
To create an 802.1Q VLAN interface on Ethernet interface eth0, with
name VLAN8 and ID 8, issue a command as root as follows:

~]# ip link add link eth0 name eth0.8 type vlan id 8

To view the VLAN, issue the following command:

~]$ ip -d link show eth0.8
4: eth0.8 at eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc
noqueue state UP mode DEFAULT
     link/ether 52:54:00:ce:5f:6c brd ff:ff:ff:ff:ff:ff promiscuity 0
     vlan protocol 802.1Q id 8 <REORDER_HDR>

Note that the ip utility interprets the VLAN ID as a hexadecimal value
if it is preceded by 0x and as an octal value if it has a leading 0.
This means that in order to assign a VLAN ID with a decimal value of
22, you must not add any leading zeros.
To remove the VLAN, issue a command as root as follows:

~]# ip link delete eth0.8

Note

VLAN interfaces created using ip commands at the command prompt will
be lost if the system is shutdown or restarted. To configure VLAN
interfaces to be persistent after a system restart, use ifcfg files.
See Section 7.4.1, “Setting Up 802.1Q VLAN Tagging Using ifcfg Files”
---

which could then be tied back to the check command with a -i eth0.8 to
check the dhcp server on vlan 8 that's trunked to eth0

so like most everything - yes.  if you put in enough effort and do it
the way that's needed and you're running the 'right' (for this
purpose.  at least to me, perhaps someone else could show you how to
do all of this in M$ with much less effort, but I wouldn't bank on
that) OS

>
>
> AMIN DJEMA
> Administrateur système
> Sys-Admin
>
> LUNE ROUGE
> 2200 rue Stanley, 3e étage
> Montréal QC, H3A 1R6
>
> B. 514.556.2101 #2326
> lunerouge.com
>
>



-- 
Even the Magic 8 ball has an opinion on email clients: Outlook not so good.


More information about the Help mailing list