LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (http://www.linuxquestions.org/questions/linux-server-73/)
-   -   zabbix - external checks (for apache) not working (http://www.linuxquestions.org/questions/linux-server-73/zabbix-external-checks-for-apache-not-working-4175452829/)

eantoranz 03-05-2013 01:57 PM

zabbix - external checks (for apache) not working
 
Hi!

I want to monitor apache from zabbix (2.0.x). I'm following this guide over here: https://www.zabbix.com/wiki/templates/apache (method 2).

I have set up the script, I have added the template, I have licked the apache template to a host but, when any of the items is checked for, I see this in the logs:

Code:

Traceback (most recent call last):
  File "/etc/zabbix/externalscripts/query_apachestats.py", line 28, in <module>
    Port = sys.argv[2]
IndexError: list index out of range

I have the hunch that the script is only getting one parameter instead of the 3 parameters the script is expecting:

Code:

# The web server IP to query
WebServer = sys.argv[1]
 
# Web server Port is the second argument
Port = sys.argv[2]
 
# Metric the user is asking for
RequestedMetric = sys.argv[3]

I'm wondering what I'll have to do so that the host IP and the port are "caught" because I don't see anything that jumps to sight in the template xml code. Perhaps I have to set up two macros?

Thanks in advance

eantoranz 03-05-2013 02:13 PM

Ok.... I had to go into the _template_ (couldn't do it at the host level) and do 2 things:

- Add the host as a first parameter to each of the items.
- Separate each parameter by a , instead of a white space.

Got the items to show up and graph... BUT there should be a way to pass the hostname or IP address as a parameter so that different servers could be linked to the same template, doesn't it make sense?

maxhq 04-16-2013 08:15 AM

It's all in the macros
 
Hi eantoranz, I just registered here to be able to answer you ;-)

You can put your items into templates by using macros (Zabbix speak for "variables"), e.g.
Code:

query_apachestats.py["{HOST.CONN1}", "arg2", "arg3"]
For an overview of all macros see Macros supported by location..

The macro {HOST.CONN1} for example resolves to the first ip/hostname you specified for each host.
There is only one trap: an ip/hostname belongs to an "interface" (SNMP, Agent, IPMI, ...).

After applying the template to the hosts be sure to check if the items (on each host) have the correct interface applied.
For what you want to do, this would be the "Agent" interface.
A good way to set it quickly is by using Zabbix' mass update function.


All times are GMT -5. The time now is 08:23 AM.