Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dev.icinga.com #7165] Invalid host address leads to exception w/ PostgreSQL #1008

Closed
icinga-migration opened this issue Sep 10, 2014 · 11 comments
Labels
area/monitoring Affects the monitoring module bug Something isn't working
Milestone

Comments

@icinga-migration
Copy link

This issue has been migrated from Redmine: https://dev.icinga.com/issues/7165

Created by harvey on 2014-09-10 08:54:47 +00:00

Assignee: aklimov
Status: Resolved (closed on 2015-05-12 14:40:04 +00:00)
Target Version: 2.0.0-rc1
Last Update: 2015-05-12 14:40:04 +00:00 (in Redmine)


clicking on the service of an incident gives sql error starting with:

Server error: SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input syntax for type inet: "####this_is_the_hostname###", query was: SELECT ho.name1 AS host_name, CASE WHEN hs.has .....

The #### text is the hostname of the system, the service incident is on, something like "server1.my.domain"

Changesets

2015-05-12 14:35:14 +00:00 by aklimov 7353c0d

IdoQuery::initializeForPostgres(): cast only valid IP addresses to inet

fixes #7165

Relations:

@icinga-migration
Copy link
Author

Updated by tgelf on 2014-09-10 12:26:45 +00:00

  • Status changed from New to Feedback
  • Assigned to set to harvey

Tried to reproduce this without success. DB type? Something special in your host/service name? Full URL?

Thanks,
Thomas

@icinga-migration
Copy link
Author

Updated by harvey on 2014-09-10 12:58:30 +00:00

Hi,

db is postgres 8.4.20 on CentOS 6.5

I have this Problem with ALL services on ALL hosts (ok, I did not check all of the 586 services, but some with the same result :-)
selecting the host in "problems->service-problems" goes to the correct hostview (right pane).
Clicking servicestab show the services(-overview), but clicking on an individual service throws the same error.

The produced URL looks goot to me, something like : icingaweb/monitoring/show/service?host=&service=

I have the problem when selecting the service in "problems->service-problems" selecting the service or in a hostview selecting any service.

Host- and Servicedefinitions are simply out of the box, eg.
object Host "dev-server3" {
import "linux-server"
address = "dev-server3.my.domain"
}
(DNS is running properly and resolving)

apply Service "swap" to Host {
import "generic-service"

check_command = "check_nrpe"
vars.remote_nrpe_command = "check_swap"
icon_image = "swap.png"
assign where "linux-server" in host.groups
}

The old icinga-web gives full details on Services (select the twisty to see more buttons) -> Details.

It looks to me that the "hostname" used in the sql-query does not fit with the type "inet"?
is "inet" "ip4|ip6" or the ipaddress of the host in dotted quad 192.168.1.1 ? - than a hostname with letters and "-" wil not match the syntax??

cu
Harvey

@icinga-migration
Copy link
Author

Updated by tgelf on 2014-09-10 13:39:41 +00:00

harvey wrote:

Host- and Servicedefinitions are simply out of the box, eg.
object Host "dev-server3" {
import "linux-server"
address = "dev-server3.my.domain"
}

This helped, thank you. Icinga Web 2 uses a virtual host_ipv4 column, it might help to get hosts sorted by IP or filtered by subnet. MySQL gives NULL for invalid IPs, Postgres seems to be stricter. You are using domain names in the "address" field - and therefore the query fails. Best practice are IPs, as the monitoring should not depend on DNS, but your config is perfectly valid.

Could you please try if removing the line saying 'host_ipv4' from modules/monitoring/library/Monitoring/Object/Service.php helps? Dropping it should be fine, it is not needed in that place.

Cheers,
Thomas

@icinga-migration
Copy link
Author

Updated by harvey on 2014-09-10 13:47:49 +00:00

Y_E_S

that helped!

thanks
Harvey

@icinga-migration
Copy link
Author

Updated by elippmann on 2014-12-12 11:41:12 +00:00

  • Status changed from Feedback to New
  • Assigned to deleted harvey

@icinga-migration
Copy link
Author

Updated by zearan on 2015-02-06 13:12:52 +00:00

Found this issue when searching for my problem. My DynDNS clients change their IPv4 addresses, so I configured their host record. Any chance to have this issue raised? =)

@icinga-migration
Copy link
Author

Updated by elippmann on 2015-03-31 08:53:25 +00:00

  • Subject changed from view of service not possible - sql error to Invalid host address leads to exception w/ PostgreSQL
  • Target Version set to 2.0.0-rc1

@icinga-migration
Copy link
Author

Updated by elippmann on 2015-03-31 13:20:30 +00:00

  • Duplicated set to 7918

@icinga-migration
Copy link
Author

Updated by aklimov on 2015-05-12 11:06:58 +00:00

  • Status changed from New to Assigned
  • Assigned to set to aklimov

@icinga-migration
Copy link
Author

Updated by aklimov on 2015-05-12 14:40:04 +00:00

  • Status changed from Assigned to Resolved
  • Done % changed from 0 to 100

Applied in changeset 7353c0d.

@icinga-migration
Copy link
Author

Updated by elippmann on 2015-06-02 07:11:32 +00:00

  • Duplicated set to 9334

@icinga-migration icinga-migration added bug Something isn't working area/monitoring Affects the monitoring module labels Jan 17, 2017
@icinga-migration icinga-migration added this to the 2.0.0-rc1 milestone Jan 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/monitoring Affects the monitoring module bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant