Invalid argument supplied for foreach()

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
blhaney
Posts: 9
Joined: Tue Jun 30, 2015 10:35 am

Invalid argument supplied for foreach()

Post by blhaney »

Yesterday I upgraded Nagios XI to 5.7.1 and as soon as it came backup the service checks for Nagios XI Daemons and Nagios XI Jobs started alerting as "Unknown". I ran the service check from command line to see if there was more detail and I received this warning:

PHP Warning: Invalid argument supplied for foreach() in /usr/local/nagios/libexec/check_nagiosxiserver.php on line 136

That is the same result for each of the service checks. I do not know enough about PHP to start messing with the script.

Any thoughts?
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: Invalid argument supplied for foreach()

Post by benjaminsmith »

Hello,

We re-wrote the backend database software in Nagios XI, so if your server has a check for the ndo2db service, you can safely delete that check in the Core Configuration Manager (CCM).

The PHP message is just a warning, so it's hard to say if that is the direct cause of the error. If you continue to get an unknown condition for the Nagios jobs make sure the IP address and apikey has not changed then send me your system profile and I'll take a closer look at the logs.

To send us your system profile.
Login to the Nagios XI GUI using a web browser.
Click the "Admin" > "System Profile" Menu
Click the "Download Profile" button
Save the profile.zip file and share in a private message or upload it to the post/ticket, and then reply to this post to bring it up in the queue.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
blhaney
Posts: 9
Joined: Tue Jun 30, 2015 10:35 am

Re: Invalid argument supplied for foreach()

Post by blhaney »

Thank you Benjamin for your reply. I am not able to private message you as it is disabled for me. So I am pasting the system info here.

Nagios XI - System Info
System
Nagios XI version: 5.7.1
Release info: kdcnagdrmon 3.10.0-1127.10.1.el7.x86_64 x86_64
Red Hat Enterprise Linux Server release 7.8 (Maipo)
Gnome is not installed
Apache Information
PHP Version: 5.4.16
Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36 OPR/68.0.3618.165
Server Name: kdcnagdrmon
Server Address: <removed>
Server Port: 80
Date/Time
PHP Timezone: US/Mountain
PHP Time: Thu, 18 Jun 2020 06:52:26 -0600
System Time: Thu, 18 Jun 2020 06:52:26 -0600
Nagios XI Data
License ends in: SMUUTP
UUID: 7119968d-703d-4436-90fa-6fa725af2256
Install Type: manual/unknown

??15690 /usr/local/nagios/libexec/check_nrpe -H <removed> -t 60 -c check_disk_MBp -a 5 3 /epic/prc05
??2578 /usr/local/nagios/bin/npcd -d -f /usr/local/nagios/etc/pnp/npcd.cfg
CPU Load 15: 1.38
Total Hosts: 188
Total Services: 3142

Function get_base_uri() returns: http://kdcnagdrmon/nagiosxi/
Function get_base_url() returns: http://kdcnagdrmon/nagiosxi/
Function get_backend_url(internal_call=false) returns: http://kdcnagdrmon/nagiosxi/includes/co ... rofile.php
Function get_backend_url(internal_call=true) returns: http://localhost/nagiosxi/backend/

Ping Test localhost
Running:
/bin/ping -c 3 localhost 2>&1
PING localhost (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.018 ms
64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.023 ms
64 bytes from localhost (127.0.0.1): icmp_seq=3 ttl=64 time=0.020 ms

--- localhost ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1999ms
rtt min/avg/max/mdev = 0.018/0.020/0.023/0.004 ms
Test wget To localhost
WGET From URL: http://localhost/nagiosxi/includes/components/ccm/
Running:
/usr/bin/wget http://localhost/nagiosxi/includes/components/ccm/
--2020-06-18 06:52:28-- http://localhost/nagiosxi/includes/components/ccm/
Resolving localhost (localhost)... ::1, 127.0.0.1
Connecting to localhost (localhost)|::1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 27 [text/html]
Saving to: '/usr/local/nagiosxi/tmp/ccm_index.tmp'

0K 100% 3.99M=0s

2020-06-18 06:52:28 (3.99 MB/s) - '/usr/local/nagiosxi/tmp/ccm_index.tmp' saved [27/27]

Network Settings
1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000

link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

inet 127.0.0.1/8 scope host lo

valid_lft forever preferred_lft forever

inet6 ::1/128 scope host

valid_lft forever preferred_lft forever

2: eno1: mtu 1500 qdisc mq master bond0 state UP group default qlen 1000

link/ether <removed> brd ff:ff:ff:ff:ff:ff

3: eno2: mtu 1500 qdisc mq master bond0 state UP group default qlen 1000

link/ether <removed> brd ff:ff:ff:ff:ff:ff

4: eno3: mtu 1500 qdisc mq state DOWN group default qlen 1000

link/ether <removed> brd ff:ff:ff:ff:ff:ff

5: eno4: mtu 1500 qdisc mq state DOWN group default qlen 1000

link/ether <removed> brd ff:ff:ff:ff:ff:ff

6: bond0: mtu 1500 qdisc noqueue state UP group default qlen 1000

link/ether <removed> brd ff:ff:ff:ff:ff:ff

inet <removed>/24 brd <removed> scope global noprefixroute bond0

valid_lft forever preferred_lft forever

inet6 fe80::1602:ecff:fe31:7698/64 scope link

valid_lft forever preferred_lft forever


default via <removed> dev bond0 proto static metric 300

<removed>/24 dev bond0 proto kernel scope link src <removed> metric 300


Nagios XI Components
actions 2.2.3
alertcloud 1.2.1
alertstream 2.1.1
autodiscovery 2.2.6
backendapiurl 1.0.5
bandwidthreport 2.0.0
bbmap 1.2.1
birdseye 3.2.4
bulkmodifications 2.3.0
capacityplanning 2.3.1
ccm 3.0.5
custom-includes 1.0.6
customlogin 1.0.0
customlogo 1.2.0
deploydashboard 1.3.0
deploynotification 1.3.3
duo 1.0.2
escalationwizard 1.5.1
favorites 1.0.0
freevariabletab 1.1.0
globaleventhandler 1.3.0
graphexplorer 2.3.0
helpsystem 2.0.1
highcharts
homepagemod 1.1.11
hypermap 1.2.1
hypermap_replay 1.2.0
isms 1.2.3
latestalerts 1.2.7
ldap_ad_integration 1.2.0
map 1.1.0
massacknowledge 2.2.2
massimmediatecheck 1.0.2
metrics 1.3.5
minemap 1.2.5
msp 1.2.0
mtr 1.0.3
nagiosbpi 3.0.0
nagioscore
nagioscorecfg
nagiosim 2.2.7
nagiosna 1.4.3
nagiosql
nagvis 2.0.4
nocscreen 1.4.0
nrdsconfigmanager 1.6.9
nxti 1.0.4
opscreen 1.8.0
perfdata
pingaction 1.1.2
pnp
profile 1.4.1
proxy 1.1.5
rdp 1.0.5
rename 1.7.0
scheduledbackups 1.2.0
scheduledreporting
similetimeline 1.5.1
snmptrapsender 1.6.2
statusmap 1.0.3
tracerouteaction 1.1.2
twilio 1.0.0
usermacros 1.1.0
xicore
Nagios XI Config Wizards
aix 1.2.1
activedirectory 1.3.5
ec2 1.1.3
s3 1.1.2
java_tomcat 1.1.0
autodiscovery 1.4.2
bpiwizard 1.1.5
bulkhostimport 2.1.3
capacity-planning 1.0.2
dhcp 1.1.7
dnsquery 1.1.6
digitalocean 1.0.3
docker 1.1.1
domain_expiration 1.1.7
email-delivery 2.0.6
esensors_websensor 1.1.7
exchange 2.0.0
ftpserver 1.5.8
folder_watch 1.0.7
genericnetdevice 1.0.5
java_glassfish 1.1.0
google-cloud 1.0.3
hyperv 1.0.2
java_jboss 1.1.0
json 1.0.0
java_jetty 1.1.0
ldapserver 1.3.5
linode 1.0.3
linux_snmp 1.5.8
linux-server 1.5.9
mssql_database 2.0.0
mssql_query 1.6.7
mssql_server 2.0.0
macosx 2.0.0
mailserver 1.2.7
microsoft-azure 1.0.3
mongodb_database 1.1.5
mongodbserver 1.1.5
mountpoint 1.0.4
mysqlquery 1.2.5
mysqlserver 1.3.5
ncpa 3.0.0
nrpe 1.6.0
nsclient 1.0.0
nagioslogserver 1.0.8
nna 1.0.8
nagiosxiserver 1.3.3
nagiostats 1.2.3
switch 2.5.3
oraclequery 1.3.9
oracleserverspace 1.5.9
oracletablespace 1.5.10
passivecheck 1.2.6
postgresdb 1.5.5
postgresquery 1.2.5
postgresserver 1.3.6
printer 1.1.5
radiusserver 2.0.4
rackspace 1.0.3
sla 1.3.4
snmp 1.6.5
snmp_trap 1.5.5
snmpwalk 2.0.1
sshproxy 1.5.9
solaris 1.3.3
tcpudpport 1.3.5
tftp 1.0.4
passiveobject 1.1.3
vmware 1.7.4
watchguard 1.4.7
webtransaction 1.2.7
java_weblogic 1.1.0
website 1.4.2
website_defacement 1.2.2
websiteurl 1.4.1
windowsdesktop 2.0.0
windowseventlog 2.0.2
windowssnmp 1.5.7
windowsserver 2.0.0
windowswmi 2.2.1
xml 1.0.0
Nagios XI Dashlets
alertcloud
bbmap
capacityplanning
graphexplorer
hypermap
latestalerts
metrics
metricsguage
minemap
xicore_xi_news_feed
xicore_getting_started
xicore_admin_tasks
xicore_eventqueue_chart
xicore_component_status
xicore_server_stats
xicore_monitoring_stats
xicore_monitoring_perf
xicore_monitoring_process
xicore_perfdata_chart
xicore_host_status_summary
xicore_service_status_summary
xicore_comments
xicore_hostgroup_status_overview
xicore_hostgroup_status_grid
xicore_servicegroup_status_overview
xicore_servicegroup_status_grid
xicore_hostgroup_status_summary
xicore_servicegroup_status_summary
xicore_available_updates
xicore_network_outages
xicore_network_outages_summary
xicore_network_health
xicore_host_status_tac_summary
xicore_service_status_tac_summary
xicore_feature_status_tac_summary
availability
custom_dashlet 1.0.7
gauges 1.2.2
googlemapdashlet 1.1.0
internettrafficreport
rss_dashlet 1.1.5
sansrisingports 2.0
sla
statusinfo 2016-04-08
worldtimeserver 2.0.0
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: Invalid argument supplied for foreach()

Post by benjaminsmith »

Hello,

My apologies, due to security and spam, you need a post count of 2 or higher to send a profile. Can you try once more? Thanks!
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
blhaney
Posts: 9
Joined: Tue Jun 30, 2015 10:35 am

Re: Invalid argument supplied for foreach()

Post by blhaney »

Hey Benjamin, I have attached it this time. See if that works.

Thanks, Blake
You do not have the required permissions to view the files attached to this post.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Invalid argument supplied for foreach()

Post by ssax »

You need to click the Download Profile button which will give you a profile.zip file, not the View System Info button.

Please attach that profile.zip.

Thank you!
blhaney
Posts: 9
Joined: Tue Jun 30, 2015 10:35 am

Re: Invalid argument supplied for foreach()

Post by blhaney »

Okay, attaching the profile.zip.

Thanks, Blake
You do not have the required permissions to view the files attached to this post.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Invalid argument supplied for foreach()

Post by ssax »

While likely unrelated, I'm seeing this:

Code: Select all

[Tue Jun 16 09:34:21.418792 2020] [:error] [pid 9036] [client X.X.43.213:25709] PHP Warning:  require_once(/usr/local/nagiosxi/html/includes/utils-sounds.inc.php): failed to open stream: No such file or directory in /usr/local/nagiosxi/html/includes/utils.inc.php on line 39, referer: http://XXXXXXX/nagiosxi/includes/page-home-main.php?&=
To fix that do this:

Code: Select all

cd /tmp
rm -rf /tmp/nagiosxi
wget https://assets.nagios.com/downloads/nagiosxi/5/xi-5.7.1.tar.gz
tar zxf xi-5.7.1.tar.gz
\cp -f /tmp/nagiosxi/nagiosxi/basedir/html/includes/utils-sounds.inc.php /usr/local/nagiosxi/html/includes/
chown nagios.nagios /tmp/nagiosxi/nagiosxi/basedir/html/includes/utils-sounds.inc.php
chmod 0644 /tmp/nagiosxi/nagiosxi/basedir/html/includes/utils-sounds.inc.php

Did you have any errors during the upgrade? Can you post the full upgrade.log? I'm thinking this file also wasn't updated, please attach it:

Code: Select all

/usr/local/nagiosxi/cron/sysstat.php
blhaney
Posts: 9
Joined: Tue Jun 30, 2015 10:35 am

Re: Invalid argument supplied for foreach()

Post by blhaney »

Please find the upgrade log attached.
You do not have the required permissions to view the files attached to this post.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Invalid argument supplied for foreach()

Post by ssax »

That looks good.

Please attach this file:

Code: Select all

/usr/local/nagiosxi/cron/sysstat.php
Or compare yours with the one I've attached and replace yours if it differs. Then wait 10 minutes and see if it's now working.
You do not have the required permissions to view the files attached to this post.
Locked