LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 03-05-2013, 01:57 PM   #1
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Costa Rica
Distribution: Kubuntu, Debian, Knoppix
Posts: 2,092
Blog Entries: 1

Rep: Reputation: 90
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
 
Old 03-05-2013, 02:13 PM   #2
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Costa Rica
Distribution: Kubuntu, Debian, Knoppix
Posts: 2,092

Original Poster
Blog Entries: 1

Rep: Reputation: 90
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?
 
Old 04-16-2013, 08:15 AM   #3
maxhq
LQ Newbie
 
Registered: Apr 2013
Location: Germany
Distribution: LMDE, Siduction
Posts: 5

Rep: Reputation: Disabled
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.
 
Old 02-10-2017, 03:05 PM   #4
Yuri Martins
LQ Newbie
 
Registered: Aug 2013
Posts: 1

Rep: Reputation: Disabled
Working fine here

I had the same problem, solved after the maxhq instructions.
Thank you very much.
 
  


Reply

Tags
apache, external scripts, zabbix



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
zabbix - postfix: postfix is running but can't see info from it on zabbix eantoranz Linux - Server 32 02-27-2013 05:28 PM
apache not working through external ip babar546 Linux - Newbie 17 12-31-2012 11:51 AM
service checks in nagios not working melborden Linux - Software 6 06-20-2012 11:23 AM
Load Balancing - ipvsadm with apache (mod_proxy) to another apache not working romeo_tango Linux - Server 1 01-12-2012 03:21 AM
Had apache working, then set up vsftpd, now apache is refusing my connections beetle_boy66 Linux - Newbie 4 01-25-2006 08:57 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 09:38 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration