PDA

View Full Version : Custom net.tcp.service and how to not target loopback.


jrandolph
03-09-2009, 18:41
I need to monitor a custom tcp port on multiple servers. Preferably I would like to do this using a template, but it seems to want to use Loopback as the IP for checking the service, and this particular service is not (and cannot) be bound to loopback and eth0 at the same time.

Is there any way to adjust this in the zabbix_agentd.conf file rather than having to add the item and trigger by hand to every one of these servers?

I'm sure this is rather rudimentary, and probably covered somewhere else, but after several hours of looking I'm starting to get a bit desperate.

Halp! :eek:

Thank you in advance!

richlv
04-09-2009, 09:22
try net.tcp.service[http,{IPADDRESS},80]

jrandolph
04-09-2009, 16:23
try net.tcp.service[http,{IPADDRESS},80]

So the answer is no. I cannot use a template for this?

richlv
04-09-2009, 16:28
i'm sorry, why can't you ? that would exactly be the way to use it with templates - you create item like that in a template, link it to hosts and host ip address is used instead of some static, single value.

jrandolph
04-09-2009, 16:35
i'm sorry, why can't you ? that would exactly be the way to use it with templates - you create item like that in a template, link it to hosts and host ip address is used instead of some static, single value.

The hosts have 3 ethernet cards on them.

Outward facing system services on eth0, middle-tier (zabbix talks to host on this IP) and db services on eth1, and iSCSI on eth2.

If I put in {ipaddress} how would Zabbix know to monitor the service using the IP on eth0, while still binding itself to eth1?

Zabbix (in our environment) cannot talk to eth0 on the hosts.


IE:
eth0: 192.168.1.2:1500 (custom tcp service I need to monitor)
eth1: 192.168.2.2 (IP zabbix talks to, middle-tier apps)
eth3: 192.168.4.2 (iSCSI)

Snippet of Zabbix config:
Server=192.168.2.250

# Server port for sending active checks

ServerPort=10051

# Unique hostname. Required for active checks.

Hostname=server01

# Listen port. Default is 10050

ListenPort=10050

# IP address to bind agent
# If missing, bind to all available IPs

#ListenIP=127.0.0.1

# Source IP address for outgoing connections

richlv
04-09-2009, 16:51
ahhhh, that you should have told right away ;)
i'm not quite sure how this could be easily achieved with templates anyway.

in your case maybe userparameters is the best solution then, next to manually setting service ip for each host.

jrandolph
04-09-2009, 17:00
Yes, sorry I really should have.

Unfortunately I was rather low on sleep when the initial query was written. It made perfect sense to me :)

I don't suppose you have an userparameter example I could reference?

richlv
04-09-2009, 17:17
well, not quite.

but you'll need to add either direct commands, or wrapper script, to all agent config files where you will want to use this - see default config files for userparam examples.

for getting ip address you could use some quick hack like /sbin/ifconfig eth0 | sed -n 's/.*inet addr:\([0-9.]*\).*/\1/ p', then perform whatever tests you want on it