![](https://secure.gravatar.com/avatar/b63b734c0c9863dc40923d5c920a8a00.jpg?s=120&d=mm&r=g)
Hi all,
I'm currently trying to get the UNIX agent for Observium working with some of our hosts so that we can obtain more data for applications, primarily NGINX.
We are now seeing data on the agent execution time graph.
We are getting responses from the Observium host to the NGINX host via Telnet, and receiving information about NGINX.
We are getting the NGINX status information through Lynx on the localhost.
We are using the following configs.
/etc/xinetd.d/observium_agent_xinetd service observium_agent { type = UNLISTED port = 36602 socket_type = stream protocol = tcp wait = no user = root server = /usr/bin/observium_agent
# configure the IPv[4|6] address(es) of your Observium server here: only_from = [IPs removed] 127.0.0.1 ::1
# Don't be too verbose. Don't log every check. This might be # commented out for debugging. If this option is commented out # the default options will be used for this service. log_on_success =
disable = no }
/usr/lib/observium_agent/local/nginx !/usr/bin/env python import urllib2 import re
data = urllib2.urlopen('http://localhost/nginx-status%27).read()
params = {}
for line in data.split("\n"): smallstat = re.match(r"\s?Reading:\s(.*)\sWriting:\s(.*)\sWaiting:\s(.*)$", line) req = re.match(r"\s+(\d+)\s+(\d+)\s+(\d+)", line) if smallstat: params["Reading"] = smallstat.group(1) params["Writing"] = smallstat.group(2) params["Waiting"] = smallstat.group(3) elif req: params["Requests"] = req.group(3) else: pass
dataorder = [ "Active", "Reading", "Writing", "Waiting", "Requests" ]
print "<<<nginx>>>\n";
for param in dataorder: if param == "Active": Active = int(params["Reading"]) + int(params["Writing"]) + int(params["Waiting"]) print Active else: print params[param]
/etc/nginx/sites-automatic/localhost.conf server { listen 80; listen [::]:80; server_name localhost; server_name_in_redirect off;
charset utf-8;
log_not_found on; access_log /var/log/nginx/localhost_combined-access.log combined buffer=128k flush=5m; error_log /var/log/nginx/localhost_error.log;
location / { root /local-storage/localhost/nginx-hosted/public_html; }
location /nginx-status { stub_status on; access_log off; allow 127.0.0.1; allow ::1; deny all; } }
Any help with this would be much appreciated.
Where can we expect to see logs? Any tips on how we can resolve this?
Regards, Alex.
![](https://secure.gravatar.com/avatar/0fa97865a0e1ab36152b6b2299eedb49.jpg?s=120&d=mm&r=g)
It looks like the nginx script isn't actually being run.
The script output will start with <<<nginx>>>
You can try running the nginx script manually to see what it outputs. The issue is probably with this script.
adam. On 05/12/2015 14:03:58, Alex Winder @ M5i alex@m5i.uk wrote: Hi all, I'm currently trying to get the UNIX agent for Observium working with some of our hosts so that we can obtain more data for applications, primarily NGINX. We are now seeing data on the agent execution time graph. We are getting responses from the Observium host to the NGINX host via Telnet, and receiving information about NGINX. We are getting the NGINX status information through Lynx on the localhost. We are using the following configs. /etc/xinetd.d/observium_agent_xinetd service observium_agent { type = UNLISTED port = 36602 socket_type = stream protocol = tcp wait = no user = root server = /usr/bin/observium_agent # configure the IPv[4|6] address(es) of your Observium server here: only_from = [IPs removed] 127.0.0.1 ::1 # Don't be too verbose. Don't log every check. This might be # commented out for debugging. If this option is commented out # the default options will be used for this service. log_on_success = disable = no } /usr/lib/observium_agent/local/nginx !/usr/bin/env python import urllib2 import re data = urllib2.urlopen('http://localhost/nginx-status [http://localhost/nginx-status%5D%27).read() params = {} for line in data.split("\n"): smallstat = re.match(r"\s?Reading:\s(.*)\sWriting:\s(.*)\sWaiting:\s(.*)$", line) req = re.match(r"\s+(\d+)\s+(\d+)\s+(\d+)", line) if smallstat: params["Reading"] = smallstat.group(1) params["Writing"] = smallstat.group(2) params["Waiting"] = smallstat.group(3) elif req: params["Requests"] = req.group(3) else: pass
dataorder = [ "Active", "Reading", "Writing", "Waiting", "Requests" ] print "<<<nginx>>>\n"; for param in dataorder: if param == "Active": Active = int(params["Reading"]) + int(params["Writing"]) + int(params["Waiting"]) print Active else: print params[param] /etc/nginx/sites-automatic/localhost.conf server { listen 80; listen [::]:80; server_name localhost; server_name_in_redirect off; charset utf-8; log_not_found on; access_log /var/log/nginx/localhost_combined-access.log combined buffer=128k flush=5m; error_log /var/log/nginx/localhost_error.log; location / { root /local-storage/localhost/nginx-hosted/public_html; } location /nginx-status { stub_status on; access_log off; allow 127.0.0.1; allow ::1; deny all; } } Any help with this would be much appreciated. Where can we expect to see logs? Any tips on how we can resolve this? Regards, Alex.
![](https://secure.gravatar.com/avatar/b63b734c0c9863dc40923d5c920a8a00.jpg?s=120&d=mm&r=g)
Hi Adam,
Thanks I now see that there is no section called <<<nginx>>> when I run /usr/bin/observium_agent locally.
When running /usr/lib/observium_agent/local/nginx we get the following: /usr/lib/observium_agent/local/nginx: line 2: import: command not found /usr/lib/observium_agent/local/nginx: line 3: import: command not found /usr/lib/observium_agent/local/nginx: line 5: syntax error near unexpected token `(' /usr/lib/observium_agent/local/nginx: line 5: `data = urllib2.urlopen('http://localhost/nginx-status%27).read()'
Any tips for diagnosing the issue?
Can you tell me how I can test /usr/lib/observium_agent/local/nginx is working correctly?
We're running Debian Jessie. We've installed Python and Python-Regex. We've pip installed urllib3.
Regards, Alex.
------ Original Message ------ From: "Adam Armstrong" adama@memetic.org To: "Alex Winder @ M5i" alex@m5i.uk; observium@observium.org Sent: 05/12/2015 14:24:55 Subject: Re: [Observium] UNIX Agent
It looks like the nginx script isn't actually being run.
The script output will start with <<<nginx>>>
You can try running the nginx script manually to see what it outputs. The issue is probably with this script.
adam.
On 05/12/2015 14:03:58, Alex Winder @ M5i alex@m5i.uk wrote:
Hi all,
I'm currently trying to get the UNIX agent for Observium working with some of our hosts so that we can obtain more data for applications, primarily NGINX.
We are now seeing data on the agent execution time graph.
We are getting responses from the Observium host to the NGINX host via Telnet, and receiving information about NGINX.
We are getting the NGINX status information through Lynx on the localhost.
We are using the following configs.
/etc/xinetd.d/observium_agent_xinetd service observium_agent { type = UNLISTED port = 36602 socket_type = stream protocol = tcp wait = no user = root server = /usr/bin/observium_agent
# configure the IPv[4|6] address(es) of your Observium server here: only_from = [IPs removed] 127.0.0.1 ::1
# Don't be too verbose. Don't log every check. This might be # commented out for debugging. If this option is commented out # the default options will be used for this service. log_on_success =
disable = no }
/usr/lib/observium_agent/local/nginx !/usr/bin/env python import urllib2 import re
data = urllib2.urlopen('http://localhost/nginx-status%27).read()
params = {}
for line in data.split("\n"): smallstat = re.match(r"\s?Reading:\s(.*)\sWriting:\s(.*)\sWaiting:\s(.*)$", line) req = re.match(r"\s+(\d+)\s+(\d+)\s+(\d+)", line) if smallstat: params["Reading"] = smallstat.group(1) params["Writing"] = smallstat.group(2) params["Waiting"] = smallstat.group(3) elif req: params["Requests"] = req.group(3) else: pass
dataorder = [ "Active", "Reading", "Writing", "Waiting", "Requests" ]
print "<<<nginx>>>\n";
for param in dataorder: if param == "Active": Active = int(params["Reading"]) + int(params["Writing"]) + int(params["Waiting"]) print Active else: print params[param]
/etc/nginx/sites-automatic/localhost.conf server { listen 80; listen [::]:80; server_name localhost; server_name_in_redirect off;
charset utf-8; log_not_found on; access_log /var/log/nginx/localhost_combined-access.log combined
buffer=128k flush=5m; error_log /var/log/nginx/localhost_error.log;
location / { root /local-storage/localhost/nginx-hosted/public_html; } location /nginx-status { stub_status on; access_log off; allow 127.0.0.1; allow ::1; deny all; }
}
Any help with this would be much appreciated.
Where can we expect to see logs? Any tips on how we can resolve this?
Regards, Alex.
![](https://secure.gravatar.com/avatar/21caf0a08d095be7196a1648d20942be.jpg?s=120&d=mm&r=g)
Alex,
You can just run the script locally to test it. Looks like it's trying to run this as bash instead of python, though? Did you copy it correctly?
First line is #!/usr/bin/env python so it should never be run as a regular shellscript.
Tom
On 05/12/2015 16:15, Alex Winder @ M5i wrote:
Hi Adam, Thanks I now see that there is no section called <<<nginx>>> when I run /usr/bin/observium_agent locally. When running /usr/lib/observium_agent/local/nginx we get the following: /usr/lib/observium_agent/local/nginx: line 2: import: command not found /usr/lib/observium_agent/local/nginx: line 3: import: command not found /usr/lib/observium_agent/local/nginx: line 5: syntax error near unexpected token `(' /usr/lib/observium_agent/local/nginx: line 5: `data = urllib2.urlopen('http://localhost/nginx-status%27).read()' Any tips for diagnosing the issue? Can you tell me how I can test /usr/lib/observium_agent/local/nginx is working correctly? We're running Debian Jessie. We've installed Python and Python-Regex. We've pip installed urllib3. Regards, Alex. ------ Original Message ------ From: "Adam Armstrong" <adama@memetic.org mailto:adama@memetic.org> To: "Alex Winder @ M5i" <alex@m5i.uk mailto:alex@m5i.uk>; observium@observium.org mailto:observium@observium.org Sent: 05/12/2015 14:24:55 Subject: Re: [Observium] UNIX Agent
It looks like the nginx script isn't actually being run.
The script output will start with <<<nginx>>>
You can try running the nginx script manually to see what it outputs. The issue is probably with this script.
adam.
On 05/12/2015 14:03:58, Alex Winder @ M5i <alex@m5i.uk mailto:alex@m5i.uk> wrote:
Hi all, I'm currently trying to get the UNIX agent for Observium working with some of our hosts so that we can obtain more data for applications, primarily NGINX. We are now seeing data on the agent execution time graph. We are getting responses from the Observium host to the NGINX host via Telnet, and receiving information about NGINX. We are getting the NGINX status information through Lynx on the localhost. We are using the following configs. */etc/xinetd.d/observium_agent_xinetd* service observium_agent { type = UNLISTED port = 36602 socket_type = stream protocol = tcp wait = no user = root server = /usr/bin/observium_agent # configure the IPv[4|6] address(es) of your Observium server here: only_from = [IPs removed] 127.0.0.1 ::1 # Don't be too verbose. Don't log every check. This might be # commented out for debugging. If this option is commented out # the default options will be used for this service. log_on_success = disable = no } */usr/lib/observium_agent/local/nginx* !/usr/bin/env python import urllib2 import re data = urllib2.urlopen('http://localhost/nginx-status%27).read() params = {} for line in data.split("\n"): smallstat = re.match(r"\s?Reading:\s(.*)\sWriting:\s(.*)\sWaiting:\s(.*)$", line) req = re.match(r"\s+(\d+)\s+(\d+)\s+(\d+)", line) if smallstat: params["Reading"] = smallstat.group(1) params["Writing"] = smallstat.group(2) params["Waiting"] = smallstat.group(3) elif req: params["Requests"] = req.group(3) else: pass
dataorder = [ "Active", "Reading", "Writing", "Waiting", "Requests" ] print "<<<nginx>>>\n"; for param in dataorder: if param == "Active": Active = int(params["Reading"]) + int(params["Writing"]) + int(params["Waiting"]) print Active else: print params[param] */etc/nginx/sites-automatic/localhost.conf* server { listen 80; listen [::]:80; server_name localhost; server_name_in_redirect off; charset utf-8; log_not_found on; access_log /var/log/nginx/localhost_combined-access.log combined buffer=128k flush=5m; error_log /var/log/nginx/localhost_error.log; location / { root /local-storage/localhost/nginx-hosted/public_html; } location /nginx-status { stub_status on; access_log off; allow 127.0.0.1; allow ::1; deny all; } } Any help with this would be much appreciated. Where can we expect to see logs? Any tips on how we can resolve this? Regards, Alex.
observium mailing list observium@observium.org http://postman.memetic.org/cgi-bin/mailman/listinfo/observium
![](https://secure.gravatar.com/avatar/b63b734c0c9863dc40923d5c920a8a00.jpg?s=120&d=mm&r=g)
Hi Tom,
Thanks, Adam pointed it out to me earlier. All working now! Thanks for all the help! :-)
Regards, Alex.
------ Original Message ------ From: "Tom Laermans" tom.laermans@powersource.cx To: "Alex Winder@M5i" alex@m5i.uk; "Observium Network Observation System" observium@observium.org Sent: 05/12/2015 19:46:25 Subject: Re: [Observium] UNIX Agent
Alex,
You can just run the script locally to test it. Looks like it's trying to run this as bash instead of python, though? Did you copy it correctly?
First line is #!/usr/bin/env python so it should never be run as a regular shellscript.
Tom
On 05/12/2015 16:15, Alex Winder @ M5i wrote:
Hi Adam,
Thanks I now see that there is no section called <<<nginx>>> when I run /usr/bin/observium_agent locally.
When running /usr/lib/observium_agent/local/nginx we get the following: /usr/lib/observium_agent/local/nginx: line 2: import: command not found /usr/lib/observium_agent/local/nginx: line 3: import: command not found /usr/lib/observium_agent/local/nginx: line 5: syntax error near unexpected token `(' /usr/lib/observium_agent/local/nginx: line 5: `data = urllib2.urlopen('http://localhost/nginx-status%27).read()'
Any tips for diagnosing the issue?
Can you tell me how I can test /usr/lib/observium_agent/local/nginx is working correctly?
We're running Debian Jessie. We've installed Python and Python-Regex. We've pip installed urllib3.
Regards, Alex.
------ Original Message ------ From: "Adam Armstrong" adama@memetic.org To: "Alex Winder @ M5i" alex@m5i.uk; observium@observium.org Sent: 05/12/2015 14:24:55 Subject: Re: [Observium] UNIX Agent
It looks like the nginx script isn't actually being run.
The script output will start with <<<nginx>>>
You can try running the nginx script manually to see what it outputs. The issue is probably with this script.
adam.
On 05/12/2015 14:03:58, Alex Winder @ M5i alex@m5i.uk wrote:
Hi all,
I'm currently trying to get the UNIX agent for Observium working with some of our hosts so that we can obtain more data for applications, primarily NGINX.
We are now seeing data on the agent execution time graph.
We are getting responses from the Observium host to the NGINX host via Telnet, and receiving information about NGINX.
We are getting the NGINX status information through Lynx on the localhost.
We are using the following configs.
/etc/xinetd.d/observium_agent_xinetd service observium_agent { type = UNLISTED port = 36602 socket_type = stream protocol = tcp wait = no user = root server = /usr/bin/observium_agent
# configure the IPv[4|6] address(es) of your Observium server here: only_from = [IPs removed] 127.0.0.1 ::1
# Don't be too verbose. Don't log every check. This might be # commented out for debugging. If this option is commented out # the default options will be used for this service. log_on_success =
disable = no }
/usr/lib/observium_agent/local/nginx !/usr/bin/env python import urllib2 import re
data = urllib2.urlopen('http://localhost/nginx-status%27).read()
params = {}
for line in data.split("\n"): smallstat = re.match(r"\s?Reading:\s(.*)\sWriting:\s(.*)\sWaiting:\s(.*)$", line) req = re.match(r"\s+(\d+)\s+(\d+)\s+(\d+)", line) if smallstat: params["Reading"] = smallstat.group(1) params["Writing"] = smallstat.group(2) params["Waiting"] = smallstat.group(3) elif req: params["Requests"] = req.group(3) else: pass
dataorder = [ "Active", "Reading", "Writing", "Waiting", "Requests" ]
print "<<<nginx>>>\n";
for param in dataorder: if param == "Active": Active = int(params["Reading"]) + int(params["Writing"]) + int(params["Waiting"]) print Active else: print params[param]
/etc/nginx/sites-automatic/localhost.conf server { listen 80; listen [::]:80; server_name localhost; server_name_in_redirect off;
charset utf-8; log_not_found on; access_log /var/log/nginx/localhost_combined-access.log combined
buffer=128k flush=5m; error_log /var/log/nginx/localhost_error.log;
location / { root /local-storage/localhost/nginx-hosted/public_html; } location /nginx-status { stub_status on; access_log off; allow 127.0.0.1; allow ::1; deny all; }
}
Any help with this would be much appreciated.
Where can we expect to see logs? Any tips on how we can resolve this?
Regards, Alex.
_______________________________________________ observium mailing list observium@observium.orghttp://postman.memetic.org/cgi-bin/mailman/listinfo/observium
participants (3)
-
Adam Armstrong
-
Alex Winder @ M5i
-
Tom Laermans