check_ping: <max_packets> (%s) must be a non-negative number

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.
donnyforbes
Posts: 357
Joined: Tue Jun 13, 2017 2:17 pm

check_ping: <max_packets> (%s) must be a non-negative number

Post by donnyforbes »

For some reason I am seeing the following on my console. I did not change anything, this is a new install and it was fine, but now I am seeing this error message
check_ping: <max_packets> (%s) must be a non-negative number

I have attached it as well..
Attachments
Capture.PNG
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: check_ping: <max_packets> (%s) must be a non-negative nu

Post by mcapra »

Can you share your check_ping command definition, one of the problematic host definitions, and any host templates that might be used for the hosts that are experiencing this issue?

The message you are seeing is exclusive to a non-positive number being provided via the -p argument to the check_ping plugin:

Code: Select all

		case 'p':	/* number of packets to send */
			if (is_intnonneg (optarg))
				max_packets = atoi (optarg);
			else
				usage2 (_("<max_packets> (%s) must be a non-negative number\n"), optarg);
			break;
Last edited by mcapra on Thu Jun 22, 2017 12:39 pm, edited 2 times in total.
Former Nagios employee
https://www.mcapra.com/
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: check_ping: <max_packets> (%s) must be a non-negative nu

Post by dwhitfield »

What's the output of cat /etc/passwd? You seem to have a lot of files get changed without you knowing about it. Are you running puppet, chef, or some other software that could be overwriting files?
donnyforbes
Posts: 357
Joined: Tue Jun 13, 2017 2:17 pm

Re: check_ping: <max_packets> (%s) must be a non-negative nu

Post by donnyforbes »

Sorry I was just off yesterday and just got into and saw this. Here is the output of /etc/password -- also nothing else is on this server except for Nagios.

Code: Select all

[root@nag ~]# cat /etc/passwd
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
adm:x:3:4:adm:/var/adm:/sbin/nologin
lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
halt:x:7:0:halt:/sbin:/sbin/halt
mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
operator:x:11:0:operator:/root:/sbin/nologin
games:x:12:100:games:/usr/games:/sbin/nologin
ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin
nobody:x:99:99:Nobody:/:/sbin/nologin
dbus:x:81:81:System message bus:/:/sbin/nologin
polkitd:x:999:998:User for polkitd:/:/sbin/nologin
avahi:x:70:70:Avahi mDNS/DNS-SD Stack:/var/run/avahi-daemon:/sbin/nologin
avahi-autoipd:x:170:170:Avahi IPv4LL Stack:/var/lib/avahi-autoipd:/sbin/nologin
postfix:x:89:89::/var/spool/postfix:/sbin/nologin
sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
systemd-bus-proxy:x:998:996:systemd Bus Proxy:/:/sbin/nologin
systemd-network:x:192:192:systemd Network Management:/:/sbin/nologin
apache:x:48:48:Apache:/usr/share/httpd:/sbin/nologin
nagios:x:1000:1000::/home/nagios:/bin/bash
[root@nag ~]#
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: check_ping: <max_packets> (%s) must be a non-negative nu

Post by dwhitfield »

Did you see @mcapra's question?

Also, what version of Core are you using? Was it compiled from source or installed from distro repos? On what OS/version is nagios running? cat /etc/*-release may be of use.
donnyforbes
Posts: 357
Joined: Tue Jun 13, 2017 2:17 pm

Re: check_ping: <max_packets> (%s) must be a non-negative nu

Post by donnyforbes »

here you go.
Also, what version of Core are you using? Was it compiled from source or installed from distro repos? On what OS/version is nagios running? cat /etc/*-release may be of use.

Core version: nagios.4.3.2
this was complied from source

Code: Select all

[root@nag nagios]# cat /etc/*-release
CentOS Linux release 7.0.1406 (Core)
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CentOS Linux release 7.0.1406 (Core)
CentOS Linux release 7.0.1406 (Core)
[root@nag nagios]#
This was working fine until I rebooted the sever.
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: check_ping: <max_packets> (%s) must be a non-negative nu

Post by dwhitfield »

Can you share your check_ping command definition, one of the problematic host definitions, and any host templates that might be used for the hosts that are experiencing this issue?
donnyforbes
Posts: 357
Joined: Tue Jun 13, 2017 2:17 pm

Re: check_ping: <max_packets> (%s) must be a non-negative nu

Post by donnyforbes »

Can you share your check_ping command definition, one of the problematic host definitions, and any host templates that might be used for the hosts that are experiencing this issue?
I can share my commands.cfg file with you. I am using the default stuff for check_ping I haven't done anything with it. The problem started when I rebooted the nagios server.
Once I did that it did not come up. Here is what I am seeing in the /var/logs/messages file.

Code: Select all

Jun 23 08:12:38 nag systemd: Starting Nagios Core Monitoring Daemon...
Jun 23 08:12:38 nag systemd: Failed at step EXEC spawning /usr/lib/systemd/scripts/nagios: No such file or directory
Jun 23 08:12:38 nag systemd: nagios.service: control process exited, code=exited status=203
Jun 23 08:12:38 nag systemd: Failed to start Nagios Core Monitoring Daemon.
Jun 23 08:12:38 nag systemd: Unit nagios.service entered failed state.
Jun 23 08:12:38 nag systemd: nagios.service failed.
would you like me to send you my /usr/local/nagios/etc/objects/commands.cfg file?
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: check_ping: <max_packets> (%s) must be a non-negative nu

Post by dwhitfield »

Does your nagios server get it's IP off of DHCP? If so, you should set it statically.

How often does your DNS update?
donnyforbes
Posts: 357
Joined: Tue Jun 13, 2017 2:17 pm

Re: check_ping: <max_packets> (%s) must be a non-negative nu

Post by donnyforbes »

no it is not DHCP. I have a static ip. One thing I noticed was in the /etc/sysconfig/network-scripts/ifcfg-eth0 the ipaddress was set to 192.168.1.39, and when doing ifconfig it was 192.168.1.186
I did changed it and rebooted the server still not working. Here is the change below

Code: Select all

[root@nag ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
TYPE="Ethernet"
BOOTPROTO="none"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="no"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_PEERDNS="yes"
IPV6_PEERROUTES="yes"
IPV6_FAILURE_FATAL="no"
NAME="eth0"
UUID="8eb6618e-6052-4a47-8174-68f6e500c419"
ONBOOT="yes"
HWADDR="00:15:5D:01:7E:05"
IPADDR0="192.168.1.186"
PREFIX0="24"
GATEWAY0="192.168.1.1"
DNS1="192.168.1.23"
DNS2="192.168.1.22"
DOMAIN="domian_name_here"
Still getting this in the /var/log/messages
Jun 23 08:41:36 nag systemd: Starting Nagios Core Monitoring Daemon...
Jun 23 08:41:36 nag systemd: Failed at step EXEC spawning /usr/lib/systemd/scripts/nagios: No such file or directory
Jun 23 08:41:36 nag systemd: nagios.service: control process exited, code=exited status=203
Jun 23 08:41:36 nag systemd: Failed to start Nagios Core Monitoring Daemon.
Jun 23 08:41:36 nag systemd: Unit nagios.service entered failed state.
Jun 23 08:41:36 nag systemd: nagios.service failed.

Any ideas?
Locked