[ixpmanager] Nagios problem

bbalaawi@mtit.gov.ps bbalaawi at mtit.gov.ps
Tue Sep 29 23:23:15 IST 2020


Dear supporter

Now , i am installed nagios 4.4.6 with ubuntu 20.04 ,and take the procedure from next site:

https://www.howtoforge.com/tutorial/how-to-install-nagios-on-ubuntu-2004/#:~:text=the%20Nagios%20server.-,%2D%20Install%20NRPE%20Server%20on%20the%20Client01%20Server,client01%22%20server%20using%20your%20ssh.&text=Once%20you've%20logged%20in,Nagios%20Plugins%20and%20NRPE%20Server.&text=Next%2C%20go%20to%20the%20NRPE,cfg%22.

it running normal until Install Nagios Plugins and create folder server for all server hots configurations. and get script from inex like this :

root at agios:/srv/nagios# ll
total 48
drwxr-xr-x 2 root root 4096 Sep 29 21:10 ./
drwxr-xr-x 3 root root 4096 Sep 29 20:09 ../
-rwxr-xr-x 1 root root 2167 Sep 29 17:21 ixp-manager-check-switch.sh*
-rwxr-xr-x 1 root root 2334 Sep 29 17:22 nagios-global-vars.sh*
-rwxr-xr-x 1 root root 1354 Sep 29 17:45 nagios-service.sh*
-rwxr-xr-x 1 root root  156 May 15 01:58 README.md*
-rwxr-xr-x 1 root root 3358 May 15 01:58 update-nagios-birdseye-daemons.sh*
-rwxr-xr-x 1 root root 4020 May 15 01:58 update-nagios-birdseye-sessions.sh*
-rwxr-xr-x 1 root root 3488 May 15 01:58 update-nagios-customers.sh*
-rwxr-xr-x 1 root root 8119 May 15 01:58 update-nagios.sh*
-rwxr-xr-x 1 root root 3085 May 15 01:58 update-nagios-switches.sh*

root at agios:/srv/nagios# cat nagios-global-vars.sh
#! /usr/bin/env bash
#
# Copyright (C) 2009 - 2019 Internet Neutral Exchange Association Company Limited By Guarantee.
# All Rights Reserved.
#
# This file is part of IXP Manager.
#
# IXP Manager 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, version 2.0 of the License.
#
# IXP Manager 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 v2.0
# along with IXP Manager.  If not, see:
#
# http://www.gnu.org/licenses/gpl-2.0.html
#
# Denis Nolan <denis.nolan -at- inex.ie>, July 2017
# Barry O'Donovan <barry.odonovan -at- inex.ie>

# Example script for updating Nagios target configuration from IXP Manager

# See: http://docs.ixpmanager.org/features/nagios/

## SET THE FOLLOWING VARIABLES APPROPRIATELY

KEY="QJdu6J2GLnjGonoIYjxLfcAERFTCeX1j5VdAWAM5UM02rx1v"
URL="http://192.168.1.202/api/v4/nagios"

# where to store the Nagios host/service configuration files:
#CONFPATH="/usr/local/etc/nagios/conf.d"
CONFPATH="/usr/local/nagios/etc/servers"

# Main Nagios configuration file:
#NAGIOSCONF="/etc/nagios/nagios.cfg"
NAGIOSCONF="/usr/local/nagios/etc/nagios.cfg"

# nagios binary:
#NAGIOS="/usr/local/bin/nagios"
NAGIOS="/usr/local/nagios/bin/nagios"

# Command to make Nagios reload its configuration:
#NAGIOS_RELOAD="/usr/local/etc/rc.d/nagios reload"
NAGIOS_RELOAD="/usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg"

# List of infrastructure IDs to create switch targets for:
# INFRA="1 2"
INFRA="1"

# List of VLANs to generate customer reachability / host targets for
# VLANS="1 2"
VLANS="1"

# List IP protocols:
#PROTOCOLS="4 6"
PROTOCOLS="4"

# BIRDTYPE: 1 = route servers | 2 = route collectors | 3 = as112
# To create BGP session checks for all routers, set this to:
# BIRDTYPE="1 2 3"
BIRDTYPE="1"

# BIRDTEMPLATE: set to name of custom template name, otherwise leave
# as default
BIRDTEMPLATE="default"

### END "SET THE FOLLOWING VARIABLES APPROPRIATELY" ###

# SCRIPTPATH - to ensure scripts are always run in the same directory
SCRIPTPATH=$PWD
root at agios:/srv/nagios#

root at agios:/srv/nagios# cat ixp-manager-check-switch.sh
#! /usr/bin/env bash
#
# See: http://docs.ixpmanager.org/features/nagios/

# Parse arguments
APIKEY="QJdu6J2GLnjGonoIYjxLfcAERFTCeX1j5VdAWAM5UM02rx1v"
URL="http://192.168.1.202/"
DEBUG=0
ID="1"

usage() { echo "Usage: $0 -k <apikey> -i <switch-db-id> -u <ixp-manager-base-url> [-d]" 1>&2; exit 1; }

hash jq   2>/dev/null || { echo >&2 "I require jq but it's not installed.  Aborting."; exit 1; }
hash wget 2>/dev/null || { echo >&2 "I require wget but it's not installed.  Aborting."; exit 1; }

while getopts ":k:i:u:d" o; do
    case "${o}" in
        k)
            APIKEY=${OPTARG}
            ;;
        i)
            ID=${OPTARG}
            ;;
        u)
            URL=${OPTARG}
            ;;
        d)
            DEBUG=1
            ;;
        *)
            usage
            ;;
    esac
done
shift $((OPTIND-1))

if [ -z "${APIKEY}" ] || [ -z "${ID}" ]; then
    usage
fi


STATUS="$( wget -O - -q  "${URL}/api/v4/switch/${ID}/status?apikey=${APIKEY}" )"

if [ $? -ne 0 ] || [ -z "$STATUS" ]; then
    echo Could not query switch status via API
    exit 3
fi

if [ "X`echo $STATUS | jq .status`X" = "XtrueX" ]; then
    RETCODE=0;
else
    RETCODE=2;
fi

while read line; do
    echo -n "${line} "
done< <(echo $STATUS | jq -r '.msgs[]')

echo

exit $RETCODE

root at agios:/srv/nagios#

root at agios:/srv/nagios# cat nagios-service.sh
#! /usr/bin/env bash
#

# Example script for updating Nagios target configuration from IXP Manager

# See: http://docs.ixpmanager.org/features/nagios/

if [[ $RELOAD -eq 1 ]]; then
    if [ $DEBUG -ne 0 ]; then
        echo "Nagios reloading..."
        $NAGIOS -v $NAGIOSCONF && $NAGIOS_RELOAD
    else
        $NAGIOS -v >/dev/null && $NAGIOS_RELOAD &>/dev/null 2>&1
    fi
else
    if [ $DEBUG -ne 0 ]; then
        echo "Nagios not reloading as no reload scheduled."
    fi
fi

exit 0
root at agios:/srv/nagios#

root at agios:/srv/nagios# ./nagios-service.sh
./nagios-service.sh: line 37: [: -ne: unary operator expected              ---------------------> there is problem
root at agios:/srv/nagios#

root at agios:/usr/local/nagios/etc/servers# ll
total 32
drwxr-xr-x 2 root   root   4096 Sep 29 21:37 ./
drwxrwxr-x 4 nagios nagios 4096 Sep 29 21:03 ../
-rw-r--r-- 1 root   root   3007 Sep 29 21:13 birdseye-daemon-vlan1.cfg
-rw-r--r-- 1 root   root   5253 Sep 29 21:13 birdseye-sessions-vlan1-type-1-IPv4.cfg
-rw-r--r-- 1 root   root   7917 Sep 29 21:14 customers-vlan1-ipv4.cfg
-rw-r--r-- 1 root   root   3722 Sep 29 21:14 switches-infraid-1.cfg

I am not install NRPE Plugin at ixp manager or route server .

but after that the service stop and can't restart  ,why???

root at agios:/usr/local/nagios/etc# systemctl restart nagios.service
Job for nagios.service failed because the control process exited with error code.
See "systemctl status nagios.service" and "journalctl -xe" for details.

root at agios:/usr/local/nagios/etc# systemctl status nagios.service
● nagios.service - Nagios Core 4.4.6
     Loaded: loaded (/lib/systemd/system/nagios.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Tue 2020-09-29 22:11:28 UTC; 16s ago
       Docs: https://www.nagios.org/documentation
    Process: 10876 ExecStartPre=/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg (code=exited, status=1/FAILURE)
    Process: 10884 ExecStopPost=/usr/bin/rm -f /usr/local/nagios/var/rw/nagios.cmd (code=exited, status=0/SUCCESS)

Sep 29 22:11:28 agios nagios[10876]: ***> One or more problems was encountered while processing the config files...
Sep 29 22:11:28 agios nagios[10876]:      Check your configuration file(s) to ensure that they contain valid
Sep 29 22:11:28 agios nagios[10876]:      directives and data definitions.  If you are upgrading from a previous
Sep 29 22:11:28 agios nagios[10876]:      version of Nagios, you should be aware that some variables/definitions
Sep 29 22:11:28 agios nagios[10876]:      may have been removed or modified in this version.  Make sure to read
Sep 29 22:11:28 agios nagios[10876]:      the HTML documentation regarding the config files, as well as the
Sep 29 22:11:28 agios nagios[10876]:      'Whats New' section to find out what has changed.
Sep 29 22:11:28 agios systemd[1]: nagios.service: Control process exited, code=exited, status=1/FAILURE
Sep 29 22:11:28 agios systemd[1]: nagios.service: Failed with result 'exit-code'.
Sep 29 22:11:28 agios systemd[1]: Failed to start Nagios Core 4.4.6.

root at agios:/usr/local/nagios/etc# journalctl -xe
-- An ExecStartPre= process belonging to unit nagios.service has exited.
-
-- The process' exit code is 'exited' and its exit status is 1.
Sep 29 22:11:28 agios systemd[1]: nagios.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- The unit nagios.service has entered the 'failed' state with result 'exit-code'.
Sep 29 22:11:28 agios systemd[1]: Failed to start Nagios Core 4.4.6.
-- Subject: A start job for unit nagios.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A start job for unit nagios.service has finished with a failure.
--
-- The job identifier is 2530 and the job result is failed.
Sep 29 22:11:29 agios multipathd[706]: sda: add missing path
Sep 29 22:11:29 agios multipathd[706]: sda: failed to get udev uid: Invalid argument
Sep 29 22:11:29 agios multipathd[706]: sda: failed to get sysfs uid: Invalid argument
Sep 29 22:11:29 agios multipathd[706]: sda: failed to get sgio uid: No such file or directory
Sep 29 22:11:34 agios multipathd[706]: sda: add missing path
Sep 29 22:11:34 agios multipathd[706]: sda: failed to get udev uid: Invalid argument
Sep 29 22:11:34 agios multipathd[706]: sda: failed to get sysfs uid: Invalid argument
Sep 29 22:11:34 agios multipathd[706]: sda: failed to get sgio uid: No such file or directory
Sep 29 22:11:44 agios multipathd[706]: sda: add missing path
Sep 29 22:11:44 agios multipathd[706]: sda: failed to get udev uid: Invalid argument
Sep 29 22:11:44 agios multipathd[706]: sda: failed to get sysfs uid: Invalid argument
Sep 29 22:11:44 agios multipathd[706]: sda: failed to get sgio uid: No such file or directory
Sep 29 22:11:49 agios multipathd[706]: sda: add missing path
Sep 29 22:11:49 agios multipathd[706]: sda: failed to get udev uid: Invalid argument
Sep 29 22:11:49 agios multipathd[706]: sda: failed to get sysfs uid: Invalid argument
Sep 29 22:11:49 agios multipathd[706]: sda: failed to get sgio uid: No such file or directory
Sep 29 22:11:54 agios multipathd[706]: sda: add missing path
Sep 29 22:11:55 agios multipathd[706]: sda: failed to get udev uid: Invalid argument
Sep 29 22:11:55 agios multipathd[706]: sda: failed to get sysfs uid: Invalid argument
Sep 29 22:11:55 agios multipathd[706]: sda: failed to get sgio uid: No such file or directory
root at agios:/usr/local/nagios/etc#

Where is the problem?
--
Eng.Basil Elbalaawi 
QOS Department - Complaints Unit
bbalaawi at mtit.gov.ps 
SecdepBasil at yahoo.com
Jawwal 0599409108
Wataniay 0562504972
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.inex.ie/pipermail/ixpmanager/attachments/20200929/acdaea85/attachment.htm>


More information about the ixpmanager mailing list