Error nagios-exec-start-pre

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
l4t1g0
Posts: 1
Joined: Thu Jun 16, 2022 4:02 pm

Error nagios-exec-start-pre

Post by l4t1g0 »

Hi guys,
I installed nagios-4.4.7-1.1.i586 on tumbleweed 20220527, when I try to start it I get the next error:

jun 16 15:47:27 repo01 systemd[1]: Starting Network Monitor Nagios...
jun 16 15:47:28 repo01 nagios-exec-start-pre[5827]: /usr/lib/nagios/nagios-exec-start-pre: línea 17: shift: contador de desplazamiento fuera de rango
jun 16 15:47:28 repo01 nagios-exec-start-pre[5873]: chmod: cambiando los permisos de '/etc/nagios/resource.cfg': Sistema de ficheros de sólo lectura
jun 16 15:47:28 repo01 nagios-exec-start-pre[5874]: chown: cambiando el propietario de '/etc/nagios/resource.cfg': Sistema de ficheros de sólo lectura
jun 16 15:47:28 repo01 systemd[1]: nagios.service: Control process exited, code=exited, status=1/FAILURE
jun 16 15:47:28 repo01 systemd[1]: nagios.service: Failed with result 'exit-code'.
jun 16 15:47:28 repo01 systemd[1]: Failed to start Network Monitor Nagios.


Current installed packages are:
nagios-theme-switcher-1.4-2.14.noarch
nagios-4.4.7-1.1.i586
nagios-rpm-macros-0.14-3.3.noarch
nagios-www-4.4.7-1.1.i586

resource.cfg perms
repo01:/home/jose # ll /etc/nagios/resource.cfg
-rw-rw-rw- 1 nagios nagcmd 1308 may 25 13:40 /etc/nagios/resource.cfg

This is the first 20 lines from /usr/lib/nagios/nagios-exec-start-pre
1 #! /bin/sh
2 # Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany
3 #
4 # Original Author: Tim Hardeck
5 # bases on the SUSE Icinga init script from Wolfgang Rosenauer, Lars Vogdt
6 #
7 CONFIG='/etc/nagios/nagios.cfg'
8
9 # grab a config option
10 get_var() {
11 echo "$(whoami)," $1 "," $2 >> /tmp/0.txt
12 if [ -n "$2" ]; then
13 set -- `grep ^$1 $2 | sed 's@=@ @' | tr -d '[:cntrl:]'`
14 else
15 set -- `grep ^$1 "$CONFIG" | sed 's@=@ @' | tr -d '[:cntrl:]'`
16 fi
17 shift # remove first ARG => search-string
18 echo $*
19 }
20

Any ideas?
Thanks!
DevinPomsilina
Posts: 5
Joined: Sun May 15, 2022 6:43 am

Re: Error nagios-exec-start-pre

Post by DevinPomsilina »

I created this file:

sudo vi /etc/systemd/system/nagios.service
and added the following:

[Unit]
Description=Nagios
BindTo=network.target


[Install]
WantedBy=multi-user.target

[Service]
User=nagios
Group=nagios
Type=simple
ExecStart=/usr/local/nagios/bin/nagios /usr/local/nagios/etc/nagios.cfg
Then the following:

sudo systemctl enable /etc/systemd/system/nagios.service
sudo systemctl start nagios
sudo systemctl restart nagios
Locked