Page 1 of 2

5.6.5 Upgrade - PHP warning.

Posted: Tue Jul 23, 2019 2:25 pm
by TBT
Just completed a few upgrades of XI 5.5.7 to 5.6.5. Each upgrade was successful, but the following PHP error was noted.

PHP Warning: Invalid argument supplied for foreach() in /usr/local/nagiosxi/html/includes/components/nagiosim/nagiosim.inc.php on line 491

Please advise.

Re: 5.6.5 Upgrade - PHP warning.

Posted: Tue Jul 23, 2019 2:44 pm
by cdienger
It's an old component that can be deleted - https://support.nagios.com/forum/viewto ... hp#p281300:

Code: Select all

rm -rf /usr/local/nagiosxi/html/includes/components/nagiosim

Re: 5.6.5 Upgrade - PHP warning.

Posted: Wed Jul 24, 2019 9:14 am
by TBT
Thanks, I've removed as suggested. Also, I ran into this message:

<p><pre>SQL Error [nagiosxi] : ERROR: duplicate key value violates unique constraint "xi_mibs_mib_name_key"</pre></p>

Any advice on this one?

Re: 5.6.5 Upgrade - PHP warning.

Posted: Wed Jul 24, 2019 3:21 pm
by cdienger
It looks like it probably tried to run the commands to create the xi_mibs table twice and failed the second time because it was already created. Make sure it's there with:

Code: Select all

echo "show tables;" | mysql -uroot -pnagiosxi -Dnagiosxi
echo "describe xi_mibs" | mysql -uroot -pnagiosxi -Dnagiosxi
(you'll need to add "-h db_ip_addr" and change the username and password if the database is not the default)

Re: 5.6.5 Upgrade - PHP warning.

Posted: Thu Jul 25, 2019 10:35 am
by TBT
cdienger wrote:It looks like it probably tried to run the commands to create the xi_mibs table twice and failed the second time because it was already created. Make sure it's there with:

Code: Select all

echo "show tables;" | mysql -uroot -pnagiosxi -Dnagiosxi
echo "describe xi_mibs" | mysql -uroot -pnagiosxi -Dnagiosxi
(you'll need to add "-h db_ip_addr" and change the username and password if the database is not the default)
"nagiosxi" is actually a PostgresQL Database. The item of note is that the table appears to have no data in it (see the COPY xi_mibs statement below). This would make me question the 'duplicate key' issue.

Code: Select all

--
-- Name: xi_mibs_mib_id_seq; Type: SEQUENCE; Schema: public; Owner: nagiosxi
--

CREATE SEQUENCE xi_mibs_mib_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE public.xi_mibs_mib_id_seq OWNER TO nagiosxi;

--
-- Name: xi_mibs_mib_id_seq; Type: SEQUENCE SET; Schema: public; Owner: nagiosxi
--

SELECT pg_catalog.setval('xi_mibs_mib_id_seq', 10, true);


--
-- Name: xi_mibs; Type: TABLE; Schema: public; Owner: nagiosxi; Tablespace:
--


CREATE TABLE xi_mibs (
    mib_id integer DEFAULT nextval('xi_mibs_mib_id_seq'::regclass) NOT NULL,
    mib_name character varying(64) NOT NULL,
    mib_uploaded timestamp without time zone,
    mib_last_processed timestamp without time zone,
    mib_type e_mib_type
);


ALTER TABLE public.xi_mibs OWNER TO nagiosxi;

--
-- Name: xi_mibs_mib_name_key; Type: CONSTRAINT; Schema: public; Owner: nagiosxi; Tablespace:
--

ALTER TABLE ONLY xi_mibs
    ADD CONSTRAINT xi_mibs_mib_name_key UNIQUE (mib_name);


--
-- Name: xi_mibs_pkey; Type: CONSTRAINT; Schema: public; Owner: nagiosxi; Tablespace:
--

ALTER TABLE ONLY xi_mibs
    ADD CONSTRAINT xi_mibs_pkey PRIMARY KEY (mib_id);


COPY xi_mibs (mib_id, mib_name, mib_uploaded, mib_last_processed, mib_type) FROM stdin;
\.

Re: 5.6.5 Upgrade - PHP warning.

Posted: Thu Jul 25, 2019 4:55 pm
by cdienger
That makes some sense - the error can occur if the table tries to be created again and not necessarily if it's trying to be populated. That said, the table should be populated. Go under Admin > System Extensions > Manage MIBs, and click the Process All Traps button and then check the table again.

Re: 5.6.5 Upgrade - PHP warning.

Posted: Fri Jul 26, 2019 7:26 am
by TBT
cdienger wrote:That makes some sense - the error can occur if the table tries to be created again and not necessarily if it's trying to be populated. That said, the table should be populated. Go under Admin > System Extensions > Manage MIBs, and click the Process All Traps button and then check the table again.
Doing so results in a page full of errors stating the following over and over:

Code: Select all

SQL Error [nagiosxi] : ERROR:  syntax error at or near "SET"
LINE 1: INSERT INTO xi_mibs SET mib_type = 'process_nxti' , mib_uplo...
                            ^

Re: 5.6.5 Upgrade - PHP warning.

Posted: Fri Jul 26, 2019 3:14 pm
by tgriep
What version of postgres is the server running?
Run this and post the output.

Code: Select all

psql -V
Get this file and upload it to the ticket so we can view it.

Code: Select all

/var/lib/pgsql/data/pg_log/postgresql-Fri.log

Re: 5.6.5 Upgrade - PHP warning.

Posted: Mon Jul 29, 2019 7:45 am
by TBT
tgriep wrote:What version of postgres is the server running?
Run this and post the output.

Code: Select all

psql -V
Get this file and upload it to the ticket so we can view it.

Code: Select all

/var/lib/pgsql/data/pg_log/postgresql-Fri.log
1. psql (PostgreSQL) 8.4.20

2. There isn't a ticket, below is the output of postgresql-Fri.log

Code: Select all

ERROR:  relation "xi_notifications" does not exist
STATEMENT:  VACUUM ANALYZE xi_notifications;
ERROR:  relation "xi_notifications" does not exist
STATEMENT:  VACUUM ANALYZE xi_notifications;
ERROR:  relation "xi_notifications" does not exist
STATEMENT:  VACUUM ANALYZE xi_notifications;
ERROR:  relation "xi_notifications" does not exist
STATEMENT:  VACUUM ANALYZE xi_notifications;
ERROR:  relation "xi_notifications" does not exist
STATEMENT:  VACUUM ANALYZE xi_notifications;
ERROR:  relation "xi_notifications" does not exist
STATEMENT:  VACUUM ANALYZE xi_notifications;
ERROR:  relation "xi_notifications" does not exist
STATEMENT:  VACUUM ANALYZE xi_notifications;
ERROR:  relation "xi_notifications" does not exist
STATEMENT:  VACUUM ANALYZE xi_notifications;
ERROR:  relation "xi_notifications" does not exist
STATEMENT:  VACUUM ANALYZE xi_notifications;
ERROR:  relation "xi_notifications" does not exist
STATEMENT:  VACUUM ANALYZE xi_notifications;
WARNING:  nonstandard use of \\ in a string literal at character 119
HINT:  Use the escape string syntax for backslashes, e.g., E'\\'.
WARNING:  nonstandard use of \\ in a string literal at character 119
HINT:  Use the escape string syntax for backslashes, e.g., E'\\'.
ERROR:  relation "xi_notifications" does not exist
STATEMENT:  VACUUM ANALYZE xi_notifications;
ERROR:  relation "xi_notifications" does not exist
STATEMENT:  VACUUM ANALYZE xi_notifications;
ERROR:  relation "xi_notifications" does not exist
STATEMENT:  VACUUM ANALYZE xi_notifications;
ERROR:  relation "xi_notifications" does not exist
STATEMENT:  VACUUM ANALYZE xi_notifications;
WARNING:  nonstandard use of \\ in a string literal at character 119
HINT:  Use the escape string syntax for backslashes, e.g., E'\\'.
ERROR:  relation "xi_notifications" does not exist
STATEMENT:  VACUUM ANALYZE xi_notifications;
ERROR:  relation "xi_notifications" does not exist
STATEMENT:  VACUUM ANALYZE xi_notifications;
ERROR:  relation "xi_notifications" does not exist
STATEMENT:  VACUUM ANALYZE xi_notifications;
ERROR:  relation "xi_notifications" does not exist
STATEMENT:  VACUUM ANALYZE xi_notifications;
ERROR:  relation "xi_notifications" does not exist
STATEMENT:  VACUUM ANALYZE xi_notifications;
ERROR:  relation "xi_notifications" does not exist
STATEMENT:  VACUUM ANALYZE xi_notifications;
ERROR:  relation "xi_notifications" does not exist
STATEMENT:  VACUUM ANALYZE xi_notifications;
ERROR:  relation "xi_notifications" does not exist
STATEMENT:  VACUUM ANALYZE xi_notifications;

Re: 5.6.5 Upgrade - PHP warning.

Posted: Mon Jul 29, 2019 8:28 am
by tgriep
It looks like there could be a setting in the /etc/php.ini file that needs to be changed.
Can you post the /etc/php.ini file here so we can see it?