Page 1 of 1

Object API for ServiceStatus / StateHistory not working

Posted: Tue May 04, 2021 3:49 am
by rajasegar
Nagios 5.7.5
Red Hat 7.4

I have a strange problem.
Object API working for other command except ServiceStatus, StateHistory on the same server.
It just drops to command line after about 3 seconds.
The command picked straight from Object API help.
API is from an admin user

Code: Select all

This works for all other 6 instances, off course with different IP and API key.
[nagios@nagiosprodxi1 scripts]$/usr/bin/curl -v -XGET 'http://10.17.19.234/nagiosxi/api/v1/objects/statehistory&search=&reportperiod=last24hours&startdate=&enddate=&hostgroup=&servicegroup=&statetype=both&?apikey=n3UYgnsqnfJX84rBNqRG3qbbi2WpjFaZX4XdqJW8fG5mZPd4v4JRua26bXPtSfs6&outputtype=xml'
* About to connect() to 10.17.19.234 port 80 (#0)
*   Trying 10.17.19.234... connected
* Connected to 10.17.19.234 (10.17.19.234) port 80 (#0)
> GET /nagiosxi/api/v1/objects/statehistory&search=&reportperiod=last24hours&startdate=&enddate=&hostgroup=&servicegroup=&statetype=both&?apikey=n3UYgnsqnfJX84rBNqRG3qbbi2WpjFaZX4XdqJW8fG5mZPd4v4JRua26bXPtSfs6&outputtype=xml HTTP/1.1
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.14.3.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2
> Host: 10.17.19.234
> Accept: */*
>
* HTTP 1.0, assume close after body
< HTTP/1.0 500 Internal Server Error
< Date: Tue, 04 May 2021 08:45:59 GMT
< Server: Apache/2.2.15 (Red Hat)
< X-Powered-By: PHP/5.3.3
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Methods: POST, GET, OPTIONS, DELETE, PUT
< Content-Length: 0
< Connection: close
< Content-Type: application/xml
<
* Closing connection #0
[nagios@nagiosprodxi1 scripts]$


[nagios@nagiosprodxi3 ~]$ curl -v -XGET "http://10.17.19.234/nagiosxi/api/v1/objects/statehistory?apikey=n3UYgnsqnfJX84rBNqRG3qbbi2WpjFaZX4XdqJW8fG5mZPd4v4JRua26bXPtSfs6&pretty=1"
* About to connect() to 10.17.19.234 port 80 (#0)
*   Trying 10.17.19.234... connected
* Connected to 10.17.19.234 (10.17.19.234) port 80 (#0)
> GET /nagiosxi/api/v1/objects/statehistory?apikey=n3UYgnsqnfJX84rBNqRG3qbbi2WpjFaZX4XdqJW8fG5mZPd4v4JRua26bXPtSfs6&pretty=1 HTTP/1.1
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.16.2.3 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2
> Host: 10.17.19.234
> Accept: */*
>
* HTTP 1.0, assume close after body
< HTTP/1.0 500 Internal Server Error
< Date: Tue, 04 May 2021 08:39:12 GMT
< Server: Apache/2.2.15 (Red Hat)
< X-Powered-By: PHP/5.3.3
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Methods: POST, GET, OPTIONS, DELETE, PUT
< Content-Length: 0
< Connection: close
< Content-Type: application/json
<
* Closing connection #0
[nagios@nagiosprodxi3 ~]$
Please advice how to troubleshoot this.

Re: Object API for ServiceStatus / StateHistory not working

Posted: Tue May 04, 2021 3:00 pm
by vtrac
Hi,
Hope you are having a good day!! ... :-)

I noticed the error:

Code: Select all

* HTTP 1.0, assume close after body
< HTTP/1.0 500 Internal Server Error
Can you please check the "/var/log/httpd/error_log"?

Can you please try upgrade "curl"?

Code: Select all

yum update curl
Also, please try restart httpd:

Code: Select all

systemctl restart httpd
Now, can you please try just "servicestatus" and update outputs to this forum:

Code: Select all

/usr/bin/curl -v -XGET "http://10.17.19.234/nagiosxi/api/v1/objects/servicestatus?apikey=n3UYgnsqnfJX84rBNqRG3qbbi2WpjFaZX4XdqJW8fG5mZPd4v4JRua26bXPtSfs6&pretty=1"
"hoststatus":

Code: Select all

/usr/bin/curl -v -XGET "http://10.17.19.234/nagiosxi/api/v1/objects/hoststatus?apikey=n3UYgnsqnfJX84rBNqRG3qbbi2WpjFaZX4XdqJW8fG5mZPd4v4JRua26bXPtSfs6&pretty=1"

Best Regards,
Vinh

Re: Object API for ServiceStatus / StateHistory not working

Posted: Tue May 04, 2021 8:36 pm
by rajasegar
curl updated
httpd restarted
All nagios services restarted
Database repair script executed successfully.

No errors at all when executing the failed API in httpd/error_log

Servicestatus does not work

Code: Select all

[nagios@nagiosprodxi3 scripts]$ /usr/bin/curl -v -XGET "http://10.17.19.234/nagiosxi/api/v1/objects/servicestatus?apikey=n3UYgnsqnfJX84rBNqRG3qbbi2WpjFaZX4XdqJW8fG5mZPd4v4JRua26bXPtSfs6&pretty=1"
* About to connect() to 10.17.19.234 port 80 (#0)
*   Trying 10.17.19.234... connected
* Connected to 10.17.19.234 (10.17.19.234) port 80 (#0)
> GET /nagiosxi/api/v1/objects/servicestatus?apikey=n3UYgnsqnfJX84rBNqRG3qbbi2WpjFaZX4XdqJW8fG5mZPd4v4JRua26bXPtSfs6&pretty=1 HTTP/1.1
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.44 zlib/1.2.3 libidn/1.18 libssh2/1.4.2
> Host: 10.17.19.234
> Accept: */*
>
* HTTP 1.0, assume close after body
< HTTP/1.0 500 Internal Server Error
< Date: Wed, 05 May 2021 01:27:18 GMT
< Server: Apache/2.2.15 (Red Hat)
< X-Powered-By: PHP/5.3.3
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Methods: POST, GET, OPTIONS, DELETE, PUT
< Content-Length: 0
< Connection: close
< Content-Type: application/json
<
* Closing connection #0
[nagios@nagiosprodxi3 scripts]$
Hoststatus works fine

Code: Select all

[nagios@nagiosprodxi3 scripts]$ /usr/bin/curl -v -XGET "http://10.17.19.234/nagiosxi/api/v1/objects/hoststatus?apikey=n3UYgnsqnfJX84rBNqRG3qbbi2WpjFaZX4XdqJW8fG5mZPd4v4JRua26bXPtSfs6&pretty=1" > t.txt
* About to connect() to 10.17.19.234 port 80 (#0)
*   Trying 10.17.19.234... connected
* Connected to 10.17.19.234 (10.17.19.234) port 80 (#0)
> GET /nagiosxi/api/v1/objects/hoststatus?apikey=n3UYgnsqnfJX84rBNqRG3qbbi2WpjFaZX4XdqJW8fG5mZPd4v4JRua26bXPtSfs6&pretty=1 HTTP/1.1
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.44 zlib/1.2.3 libidn/1.18 libssh2/1.4.2
> Host: 10.17.19.234
> Accept: */*
>
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0< HTTP/1.1 200 OK
< Date: Wed, 05 May 2021 01:28:17 GMT
< Server: Apache/2.2.15 (Red Hat)
< X-Powered-By: PHP/5.3.3
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Methods: POST, GET, OPTIONS, DELETE, PUT
< Connection: close
< Transfer-Encoding: chunked
< Content-Type: application/json
<
{ [data not shown]
100 6706k    0 6706k    0     0  4955k      0 --:--:--  0:00:01 --:--:-- 4960k* Closing connection #0


Re: Object API for ServiceStatus / StateHistory not working

Posted: Wed May 05, 2021 3:11 pm
by vtrac
Hi,
How are you doing?
How many "hosts" do you have on this XI instance?
How many "services" do you have on this XI instance?

Could you try checking "object/service" instead? .... does this works?
(NOTE: This is a ONE line command):

Code: Select all

/usr/bin/curl -v -k "http://10.17.19.234/nagiosxi/api/v1/objects/service?apikey=n3UYgnsqnfJX84rBNqRG3qbbi2WpjFaZX4XdqJW8fG5mZPd4v4JRua26bXPtSfs6&pretty=1"
Let try capture error when running the "curl" command:
1). Open a command prompt on your XI machine, then run the below command.
Let its running while you do step 2 (below).
tail -f /var/log/httpd/error_log

2). Now run the "object/servicestatus" again:
(NOTE: this is a ONE line command)
curl -v -k "http://192.168.23.61/nagiosxi/api/v1/ob ... h&pretty=1"

Do you get anything in the "/var/log/httpd/error_log"? .... please upload screenshot, if possible.

Can you please run this on your XI command prompt (please upload outputs):

Code: Select all

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Lastly, please upload "profile.zip":
Admin > System Config > System Profile > "Download Profile"


Best Regards,
Vinh

Re: Object API for ServiceStatus / StateHistory not working

Posted: Wed May 05, 2021 4:06 pm
by vtrac
Also, please run and upload outputs of this command:
(NOTE: this is a ONE line command)

Code: Select all

echo "SELECT table_name AS 'Table', round(((data_length + index_length) / 1024 / 1024), 2) 'Size in MB' FROM information_schema.TABLES WHERE table_schema IN ('nagios', 'nagiosql', 'nagiosxi');" | mysql -h 127.0.0.1 -uroot -pnagiosxi --table


Regards,
Vinh

Re: Object API for ServiceStatus / StateHistory not working

Posted: Wed May 05, 2021 9:42 pm
by rajasegar
vtrac wrote:Also, please run and upload outputs of this command:
(NOTE: this is a ONE line command)

Code: Select all

echo "SELECT table_name AS 'Table', round(((data_length + index_length) / 1024 / 1024), 2) 'Size in MB' FROM information_schema.TABLES WHERE table_schema IN ('nagios', 'nagiosql', 'nagiosxi');" | mysql -h 127.0.0.1 -uroot -pnagiosxi --table


Regards,
Vinh
As requested

Code: Select all

[nagios@nagiosprodxi3 ~]$ echo "SELECT table_name AS 'Table', round(((data_length + index_length) / 1024 / 1024), 2) 'Size in MB' FROM information_schema.TABLES WHERE table_schema IN ('nagios', 'nagiosql', 'nagiosxi');" | mysql -h 127.0.0.1 -uroot -pnagiosxi --table
+--------------------------------------------+------------+
| Table                                      | Size in MB |
+--------------------------------------------+------------+
| nagios_acknowledgements                    |       0.00 |
| nagios_commands                            |       0.03 |
| nagios_commenthistory                      |     311.65 |
| nagios_comments                            |       0.17 |
| nagios_configfiles                         |       0.01 |
| nagios_configfilevariables                 |       0.01 |
| nagios_conninfo                            |       0.11 |
| nagios_contact_addresses                   |       0.01 |
| nagios_contact_notificationcommands        |       0.03 |
| nagios_contactgroup_members                |       0.01 |
| nagios_contactgroups                       |       0.00 |
| nagios_contactnotificationmethods          |      41.41 |
| nagios_contactnotifications                |      43.78 |
| nagios_contacts                            |       0.03 |
| nagios_contactstatus                       |       0.02 |
| nagios_customvariables                     |      23.41 |
| nagios_customvariablestatus                |      24.27 |
| nagios_dbversion                           |       0.00 |
| nagios_downtimehistory                     |      17.54 |
| nagios_eventhandlers                       |       1.03 |
| nagios_externalcommands                    |       0.00 |
| nagios_flappinghistory                     |     129.77 |
| nagios_host_contactgroups                  |       0.33 |
| nagios_host_contacts                       |       0.11 |
| nagios_host_parenthosts                    |       0.00 |
| nagios_hostchecks                          |       1.21 |
| nagios_hostdependencies                    |       0.00 |
| nagios_hostescalation_contactgroups        |       0.00 |
| nagios_hostescalation_contacts             |       0.00 |
| nagios_hostescalations                     |       0.00 |
| nagios_hostgroup_members                   |       0.22 |
| nagios_hostgroups                          |       0.00 |
| nagios_hosts                               |       0.52 |
| nagios_hoststatus                          |       1.43 |
| nagios_instances                           |       0.00 |
| nagios_logentries                          |    3440.58 |
| nagios_notifications                       |     114.47 |
| nagios_objects                             |       4.93 |
| nagios_processevents                       |       0.02 |
| nagios_programstatus                       |       0.00 |
| nagios_runtimevariables                    |       0.00 |
| nagios_scheduleddowntime                   |       0.00 |
| nagios_service_contactgroups               |       2.00 |
| nagios_service_contacts                    |       0.65 |
| nagios_service_parentservices              |       0.00 |
| nagios_servicechecks                       |       4.09 |
| nagios_servicedependencies                 |       0.00 |
| nagios_serviceescalation_contactgroups     |       0.00 |
| nagios_serviceescalation_contacts          |       0.00 |
| nagios_serviceescalations                  |       0.00 |
| nagios_servicegroup_members                |       0.00 |
| nagios_servicegroups                       |       0.00 |
| nagios_services                            |       3.67 |
| nagios_servicestatus                       |      10.46 |
| nagios_statehistory                        |    2796.52 |
| nagios_systemcommands                      |       0.02 |
| nagios_timedeventqueue                     |       0.00 |
| nagios_timedevents                         |       0.00 |
| nagios_timeperiod_timeranges               |       0.01 |
| nagios_timeperiods                         |       0.00 |
| PAAS_LIST                                  |       0.13 |
| tbl_command                                |       0.05 |
| tbl_contact                                |       0.04 |
| tbl_contactgroup                           |       0.01 |
| tbl_contacttemplate                        |       0.01 |
| tbl_domain                                 |       0.01 |
| tbl_host                                   |       0.31 |
| tbl_hostdependency                         |       0.00 |
| tbl_hostescalation                         |       0.00 |
| tbl_hostextinfo                            |       0.00 |
| tbl_hostgroup                              |       0.01 |
| tbl_hosttemplate                           |       0.02 |
| tbl_info                                   |       0.13 |
| tbl_lnkContactToCommandHost                |       0.00 |
| tbl_lnkContactToCommandService             |       0.00 |
| tbl_lnkContactToContactgroup               |       0.00 |
| tbl_lnkContactToContacttemplate            |       0.01 |
| tbl_lnkContactToVariabledefinition         |       0.00 |
| tbl_lnkContactgroupToContact               |       0.01 |
| tbl_lnkContactgroupToContactgroup          |       0.00 |
| tbl_lnkContacttemplateToCommandHost        |       0.00 |
| tbl_lnkContacttemplateToCommandService     |       0.00 |
| tbl_lnkContacttemplateToContactgroup       |       0.00 |
| tbl_lnkContacttemplateToContacttemplate    |       0.00 |
| tbl_lnkContacttemplateToVariabledefinition |       0.00 |
| tbl_lnkHostToContact                       |       0.00 |
| tbl_lnkHostToContactgroup                  |       0.00 |
| tbl_lnkHostToHost                          |       0.00 |
| tbl_lnkHostToHostgroup                     |       0.00 |
| tbl_lnkHostToHosttemplate                  |       0.08 |
| tbl_lnkHostToVariabledefinition            |       0.00 |
| tbl_lnkHostdependencyToHost_DH             |       0.00 |
| tbl_lnkHostdependencyToHost_H              |       0.00 |
| tbl_lnkHostdependencyToHostgroup_DH        |       0.00 |
| tbl_lnkHostdependencyToHostgroup_H         |       0.00 |
| tbl_lnkHostescalationToContact             |       0.00 |
| tbl_lnkHostescalationToContactgroup        |       0.00 |
| tbl_lnkHostescalationToHost                |       0.00 |
| tbl_lnkHostescalationToHostgroup           |       0.00 |
| tbl_lnkHostgroupToHost                     |       0.06 |
| tbl_lnkHostgroupToHostgroup                |       0.00 |
| tbl_lnkHosttemplateToContact               |       0.00 |
| tbl_lnkHosttemplateToContactgroup          |       0.00 |
| tbl_lnkHosttemplateToHost                  |       0.00 |
| tbl_lnkHosttemplateToHostgroup             |       0.00 |
| tbl_lnkHosttemplateToHosttemplate          |       0.00 |
| tbl_lnkHosttemplateToVariabledefinition    |       0.00 |
| tbl_lnkServiceToContact                    |       0.00 |
| tbl_lnkServiceToContactgroup               |       0.00 |
| tbl_lnkServiceToHost                       |       0.00 |
| tbl_lnkServiceToHostgroup                  |       0.00 |
| tbl_lnkServiceToServicegroup               |       0.00 |
| tbl_lnkServiceToServicetemplate            |       0.00 |
| tbl_lnkServiceToVariabledefinition         |       0.00 |
| tbl_lnkServicedependencyToHost_DH          |       0.00 |
| tbl_lnkServicedependencyToHost_H           |       0.00 |
| tbl_lnkServicedependencyToHostgroup_DH     |       0.00 |
| tbl_lnkServicedependencyToHostgroup_H      |       0.00 |
| tbl_lnkServicedependencyToService_DS       |       0.00 |
| tbl_lnkServicedependencyToService_S        |       0.00 |
| tbl_lnkServicedependencyToServicegroup_DS  |       0.02 |
| tbl_lnkServicedependencyToServicegroup_S   |       0.02 |
| tbl_lnkServiceescalationToContact          |       0.00 |
| tbl_lnkServiceescalationToContactgroup     |       0.00 |
| tbl_lnkServiceescalationToHost             |       0.00 |
| tbl_lnkServiceescalationToHostgroup        |       0.00 |
| tbl_lnkServiceescalationToService          |       0.00 |
| tbl_lnkServiceescalationToServicegroup     |       0.02 |
| tbl_lnkServicegroupToService               |       0.00 |
| tbl_lnkServicegroupToServicegroup          |       0.00 |
| tbl_lnkServicetemplateToContact            |       0.00 |
| tbl_lnkServicetemplateToContactgroup       |       0.00 |
| tbl_lnkServicetemplateToHost               |       0.00 |
| tbl_lnkServicetemplateToHostgroup          |       0.00 |
| tbl_lnkServicetemplateToServicegroup       |       0.00 |
| tbl_lnkServicetemplateToServicetemplate    |       0.01 |
| tbl_lnkServicetemplateToVariabledefinition |       0.00 |
| tbl_lnkTimeperiodToTimeperiod              |       0.00 |
| tbl_logbook                                |       0.00 |
| tbl_mainmenu                               |       0.00 |
| tbl_permission                             |       0.02 |
| tbl_permission_inactive                    |       0.02 |
| tbl_service                                |       0.00 |
| tbl_servicedependency                      |       0.00 |
| tbl_serviceescalation                      |       0.00 |
| tbl_serviceextinfo                         |       0.00 |
| tbl_servicegroup                           |       0.01 |
| tbl_servicetemplate                        |       0.02 |
| tbl_session                                |       0.00 |
| tbl_session_locks                          |       0.00 |
| tbl_settings                               |       0.00 |
| tbl_submenu                                |       0.00 |
| tbl_timedefinition                         |       0.01 |
| tbl_timeperiod                             |       0.01 |
| tbl_user                                   |       0.01 |
| tbl_variabledefinition                     |       0.01 |
| xi_auditlog                                |       0.06 |
| xi_auth_tokens                             |       0.03 |
| xi_cmp_ccm_backups                         |       0.02 |
| xi_cmp_favorites                           |       0.03 |
| xi_cmp_nagiosbpi_backups                   |       0.08 |
| xi_cmp_trapdata                            |       0.03 |
| xi_cmp_trapdata_log                        |       0.03 |
| xi_commands                                |       0.00 |
| xi_deploy_agents                           |       0.02 |
| xi_deploy_jobs                             |       0.02 |
| xi_eventqueue                              |       0.36 |
| xi_events                                  |       5.91 |
| xi_incidents                               |       0.00 |
| xi_meta                                    |     111.02 |
| xi_mibs                                    |       0.05 |
| xi_options                                 |       0.76 |
| xi_sessions                                |       0.03 |
| xi_sysstat                                 |       0.01 |
| xi_usermeta                                |       0.28 |
| xi_users                                   |       0.01 |
+--------------------------------------------+------------+
[nagios@nagiosprodxi3 ~]$


Re: Object API for ServiceStatus / StateHistory not working

Posted: Wed May 05, 2021 9:47 pm
by rajasegar
vtrac wrote:Hi,
How are you doing?
How many "hosts" do you have on this XI instance?
How many "services" do you have on this XI instance?

Could you try checking "object/service" instead? .... does this works?
(NOTE: This is a ONE line command):

Code: Select all

/usr/bin/curl -v -k "http://10.17.19.234/nagiosxi/api/v1/objects/service?apikey=n3UYgnsqnfJX84rBNqRG3qbbi2WpjFaZX4XdqJW8fG5mZPd4v4JRua26bXPtSfs6&pretty=1"
Let try capture error when running the "curl" command:
1). Open a command prompt on your XI machine, then run the below command.
Let its running while you do step 2 (below).
tail -f /var/log/httpd/error_log

2). Now run the "object/servicestatus" again:
(NOTE: this is a ONE line command)
curl -v -k "http://192.168.23.61/nagiosxi/api/v1/ob ... h&pretty=1"

Do you get anything in the "/var/log/httpd/error_log"? .... please upload screenshot, if possible.

Can you please run this on your XI command prompt (please upload outputs):

Code: Select all

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Lastly, please upload "profile.zip":
Admin > System Config > System Profile > "Download Profile"


Best Regards,
Vinh
Total Hosts - 2217
Total Services - 16230

"object/service" works fine

Code: Select all

[nagios@nagiosprodxi3 ~]$ /usr/bin/curl -v -k "http://10.17.19.234/nagiosxi/api/v1/objects/service?apikey=n3UYgnsqnfJX84rBNqRG3qbbi2WpjFaZX4XdqJW8fG5mZPd4v4JRua26bXPtSfs6&pretty=1" > t.txt
* About to connect() to 10.17.19.234 port 80 (#0)
*   Trying 10.17.19.234... connected
* Connected to 10.17.19.234 (10.17.19.234) port 80 (#0)
> GET /nagiosxi/api/v1/objects/service?apikey=n3UYgnsqnfJX84rBNqRG3qbbi2WpjFaZX4XdqJW8fG5mZPd4v4JRua26bXPtSfs6&pretty=1 HTTP/1.1
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.44 zlib/1.2.3 libidn/1.18 libssh2/1.4.2
> Host: 10.17.19.234
> Accept: */*
>
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:00:03 --:--:--     0< HTTP/1.1 200 OK
< Date: Thu, 06 May 2021 02:44:10 GMT
< Server: Apache/2.2.15 (Red Hat)
< X-Powered-By: PHP/5.3.3
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Methods: POST, GET, OPTIONS, DELETE, PUT
< Connection: close
< Transfer-Encoding: chunked
< Content-Type: application/json
<
{ [data not shown]
100 13.3M    0 13.3M    0     0  4477k      0 --:--:--  0:00:03 --:--:-- 4478k* Closing connection #0

As updated earlier there is nothing coming out on httpd/error_log.

Code: Select all


[nagios@nagiosprodxi3 ~]$ /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Nagios Core 4.4.6
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 2020-04-28
License: GPL

Website: https://www.nagios.org
Reading configuration data...
   Read main config file okay...
   Read object config files okay...

Running pre-flight check on configuration data...

Checking objects...
        Checked 16230 services.
        Checked 2705 hosts.
        Checked 17 host groups.
        Checked 1 service groups.
        Checked 196 contacts.
        Checked 59 contact groups.
        Checked 211 commands.
        Checked 18 time periods.
        Checked 0 host escalations.
        Checked 0 service escalations.
Checking for circular paths...
        Checked 2705 hosts
        Checked 0 service dependencies
        Checked 0 host dependencies
        Checked 18 timeperiods
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...

Total Warnings: 0
Total Errors:   0

Things look okay - No serious problems were detected during the pre-flight check
[nagios@nagiosprodxi3 ~]$
I will PM you the profile

Re: Object API for ServiceStatus / StateHistory not working

Posted: Thu May 06, 2021 2:39 pm
by vtrac
Hi,
Hope you are doing good!! ... :-)

We now know that your system is very large with "16,230" services.

We also know that the API did work for "object/service" but not "object/servicestatus".

I talked to my senior team member here and they said to increase the memory and other values to "5x" in the "/etc/php.ini" file.

So, could you please try the followings, under the "Resource Limits" section, please increase those values to at least "5x".

Code: Select all

;;;;;;;;;;;;;;;;;;;
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;

; Maximum execution time of each script, in seconds
; http://php.net/max-execution-time
; Note: This directive is hardcoded to 0 for the CLI SAPI
max_execution_time = 300

; Maximum amount of time each script may spend parsing request data. It's a good
; idea to limit this time on productions servers in order to eliminate unexpectedly
; long running scripts.
; Note: This directive is hardcoded to -1 for the CLI SAPI
; Default Value: -1 (Unlimited)
; Development Value: 60 (60 seconds)
; Production Value: 60 (60 seconds)
; http://php.net/max-input-time
max_input_time = 600

; Maximum input variable nesting level
; http://php.net/max-input-nesting-level
;max_input_nesting_level = 64

; How many GET/POST/COOKIE input variables may be accepted
max_input_vars = 25000

; Maximum amount of memory a script may consume (128MB)
; http://php.net/memory-limit
memory_limit = 1280M

We must now restart HTTP:

Code: Select all

systemctl restart httpd

Now, please try the command again. Let try capture error when running the "curl" command:
1). Open a command prompt on your XI machine, then run the below command.
Let its running while you do step 2 (below).
tail -f /var/log/httpd/error_log

2). Now run the "object/servicestatus" again. Open a second command prompt on the XI machine:
(NOTE: this is a ONE line command)
curl -v -k "http://192.168.23.61/nagiosxi/api/v1/ob ... h&pretty=1"

Please up outputs (results) and screenshot, if possible.

Best Regards,
Vinh

Re: Object API for ServiceStatus / StateHistory not working

Posted: Thu May 06, 2021 8:14 pm
by rajasegar
vtrac wrote:Hi,
Hope you are doing good!! ... :-)

We now know that your system is very large with "16,230" services.

We also know that the API did work for "object/service" but not "object/servicestatus".

I talked to my senior team member here and they said to increase the memory and other values to "5x" in the "/etc/php.ini" file.

So, could you please try the followings, under the "Resource Limits" section, please increase those values to at least "5x".

Code: Select all

;;;;;;;;;;;;;;;;;;;
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;

; Maximum execution time of each script, in seconds
; http://php.net/max-execution-time
; Note: This directive is hardcoded to 0 for the CLI SAPI
max_execution_time = 300

; Maximum amount of time each script may spend parsing request data. It's a good
; idea to limit this time on productions servers in order to eliminate unexpectedly
; long running scripts.
; Note: This directive is hardcoded to -1 for the CLI SAPI
; Default Value: -1 (Unlimited)
; Development Value: 60 (60 seconds)
; Production Value: 60 (60 seconds)
; http://php.net/max-input-time
max_input_time = 600

; Maximum input variable nesting level
; http://php.net/max-input-nesting-level
;max_input_nesting_level = 64

; How many GET/POST/COOKIE input variables may be accepted
max_input_vars = 25000

; Maximum amount of memory a script may consume (128MB)
; http://php.net/memory-limit
memory_limit = 1280M

We must now restart HTTP:

Code: Select all

systemctl restart httpd

Now, please try the command again. Let try capture error when running the "curl" command:
1). Open a command prompt on your XI machine, then run the below command.
Let its running while you do step 2 (below).
tail -f /var/log/httpd/error_log

2). Now run the "object/servicestatus" again. Open a second command prompt on the XI machine:
(NOTE: this is a ONE line command)
curl -v -k "http://192.168.23.61/nagiosxi/api/v1/ob ... h&pretty=1"

Please up outputs (results) and screenshot, if possible.

Best Regards,
Vinh
Thanks. It works fine now. You can close the thread.

Re: Object API for ServiceStatus / StateHistory not working

Posted: Fri May 07, 2021 6:36 am
by scottwilkerson
rajasegar wrote:
vtrac wrote:Hi,
Hope you are doing good!! ... :-)

We now know that your system is very large with "16,230" services.

We also know that the API did work for "object/service" but not "object/servicestatus".

I talked to my senior team member here and they said to increase the memory and other values to "5x" in the "/etc/php.ini" file.

So, could you please try the followings, under the "Resource Limits" section, please increase those values to at least "5x".

Code: Select all

;;;;;;;;;;;;;;;;;;;
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;

; Maximum execution time of each script, in seconds
; http://php.net/max-execution-time
; Note: This directive is hardcoded to 0 for the CLI SAPI
max_execution_time = 300

; Maximum amount of time each script may spend parsing request data. It's a good
; idea to limit this time on productions servers in order to eliminate unexpectedly
; long running scripts.
; Note: This directive is hardcoded to -1 for the CLI SAPI
; Default Value: -1 (Unlimited)
; Development Value: 60 (60 seconds)
; Production Value: 60 (60 seconds)
; http://php.net/max-input-time
max_input_time = 600

; Maximum input variable nesting level
; http://php.net/max-input-nesting-level
;max_input_nesting_level = 64

; How many GET/POST/COOKIE input variables may be accepted
max_input_vars = 25000

; Maximum amount of memory a script may consume (128MB)
; http://php.net/memory-limit
memory_limit = 1280M

We must now restart HTTP:

Code: Select all

systemctl restart httpd

Now, please try the command again. Let try capture error when running the "curl" command:
1). Open a command prompt on your XI machine, then run the below command.
Let its running while you do step 2 (below).
tail -f /var/log/httpd/error_log

2). Now run the "object/servicestatus" again. Open a second command prompt on the XI machine:
(NOTE: this is a ONE line command)
curl -v -k "http://192.168.23.61/nagiosxi/api/v1/ob ... h&pretty=1"

Please up outputs (results) and screenshot, if possible.

Best Regards,
Vinh
Thanks. It works fine now. You can close the thread.
Locking thread