mlazarov / supervisord-monitor

Supervisord Monitoring Tool
950 stars 224 forks source link

XML-RPC and Ubuntu #17

Closed kistasi closed 8 years ago

kistasi commented 9 years ago

Hello @mlazarov,

I'm tried to use your project on our Ubuntu server, but after the configuration, I'm noticed an error message:

The XML data received was either invalid or not in the correct form for XML-RPC. Turn on debugging to examine the XML data further.

php5-xmlrcp package is installed. I searched the fix for this, but I not found. :(

Any idea?

Thanks for advance, @kistasi @Allmyles Ltd.

mlazarov commented 9 years ago

kistasi, use tcpdump to dump the traffic between the supervisor and the monitoring app. Paste it to the pastbin and post link here.

kistasi commented 9 years ago

Here is the output: http://pastebin.com/aJcnrhx5

mlazarov commented 9 years ago

Lol, actualy this is all your traffic and not only the one between your webserver and supervisord. Please use -A flag so the actual data can be seen from the dump and don't forget to add accurate filter parameter to tcpdump command to filter only the data.

snigdhaAgarwal commented 8 years ago

I am getting the same error as above. This is the command I am using : sudo tcpdump -nl -s 0 -A -i en0 -c 500 port 80. However, I can't really understand any output. Can you please help me in resolving this issue?

mlazarov commented 8 years ago

fankee, did you turned on the xml rpc api in the supervisord config? i.e the http server? And post the output from the tcpdump to pastebin or some similar site so I can see it :)

snigdhaAgarwal commented 8 years ago

You mean this line: [rpcinterface:supervisor] supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface. I have enabled it in supervisord.conf.

I have also added the http server: [inet_http_server] port=127.0.0.1:9001
username=sagarw5 password=123

I can now see that the tcpdump output is not related to supervisord at all. Its some services' information being used in the company. What am I doing wrong? I ran the above command, and after that refreshed the supervisord-monitor page, which is appearing like this:

screen shot 2016-04-22 at 2 34 50 pm
mlazarov commented 8 years ago

Supervisor and supervisord-monitoring are both on localhost? What is the content of your supervisord.conf found in application/config folder? Did you restart the supervisor after creating changed to the config? Can you check (with telnet for example) that you can connect to 127.0.0.1:9001? Do you have some specific firewall enabled? Did you try disabling it?

snigdhaAgarwal commented 8 years ago

Yes. This is the virtual host entry in /private/etc/apache2/extra/httpd-vhosts.conf `<VirtualHost *:80> DocumentRoot "/Users/sagarw5/Documents/Projects/Supervisor/supervisord-monitor/public_html" ServerName supervisord-monitor.local

    Allow from all
</Directory>

`

This the supervisor.php file in application/config (sorry we are not allowed pastebin in our company): `<?php

// Dashboard columns. 2 or 3 $config['supervisor_cols'] = 2;

// Refresh Dashboard every x seconds. 0 to disable $config['refresh'] = 10;

// Enable or disable Alarm Sound $config['enable_alarm'] = true;

// Show hostname after server name $config['show_host'] = false;

$config['supervisor_servers'] = array( 'server01' => array( 'url' => '127.0.0.1', 'port' => '9001', 'username' => 'sagarw5', 'password' => '123' ));

// Set timeout connecting to remote supervisord RPC2 interface $config['timeout'] = 3;

// Path to Redmine new issue url $config['redmine_url'] = 'http://redmine.url/path_to_new_issue_url';

// Default Redmine assigne ID $config['redmine_assigne_id'] = '69';`

Yes I did restart supervisord using this command: /usr/local/bin/supervisord -n -c /Users/sagarw5/Downloads/supervisor-3.2.3/supervisord.conf > a.

Yes I can connect. Here is the output:

screen shot 2016-04-22 at 2 47 22 pm

Yes, I think the company has put some firewalls and we have don't have the access to disable them.

mlazarov commented 8 years ago

You can try to add this line in the application/core/MY_Controller.php after line 11

$this->{$server}->set_debug(true);

after this line:

$this->{$server}->initialize();

so the file should look like this:

$this->load->library('xmlrpc',array(),$server);
$this->{$server}->initialize();
$this->{$server}->set_debug(true);
$this->{$server}->server($config['url'],$config['port']);
$this->{$server}->method('supervisor.'.$method);
$this->{$server}->timeout($this->config->item('timeout'));

I hope this will show you what is the return data of the supervisor xmlrpc server and will give some glue what is the problem.

snigdhaAgarwal commented 8 years ago

This is what I am getting: http://pastebin.com/K4W0AJvW

mlazarov commented 8 years ago

It seems that xmlrpc interface isn't enabled. Check your configuration and be sure the supervisor daemon is restart - not just to send config reload command.

You can check if xmlrpc is enabled by opening this url: http://localhost:9001/RPC2

snigdhaAgarwal commented 8 years ago

I have tried everything. Here is the /Users/sagarw5/Downloads/supervisor-3.2.3/supervisord.conf file: `; Sample supervisor config file. ; ; For more information on the config file, please see: ; http://supervisord.org/configuration.html ; ; Notes: ; - Shell expansion ("~" or "$HOME") is not supported. Environment ; variables can be expanded using this syntax: "%(ENV_HOME)s". ; - Comments must have a leading space: "a=b ;comment" not "a=b;comment".

[unix_http_server] file=/tmp/supervisor.sock ; (the path to the socket file) ;chmod=0700 ; socket file mode (default 0700) ;chown=nobody:nogroup ; socket file uid:gid owner ;username=user ; (default is no username (open server)) ;password=123 ; (default is no password (open server))

[inet_http_server] ; inet (TCP) server disabled by default port=127.0.0.1:9001 ; (ip_address:port specifier, *:port for all iface) username=sagarw5 ; (default is no username (open server)) password=123 ; (default is no password (open server))

[supervisord] logfile=/tmp/supervisord.log ; (main log file;default $CWD/supervisord.log) logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB) logfile_backups=10 ; (num of main logfile rotation backups;default 10) loglevel=info ; (log level;default info; others: debug,warn,trace) pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid) nodaemon=false ; (start in foreground if true;default false) minfds=1024 ; (min. avail startup file descriptors;default 1024) minprocs=200 ; (min. avail process descriptors;default 200) ;umask=022 ; (process file creation umask;default 022) ;user=chrism ; (default is current user, required if root) ;identifier=supervisor ; (supervisord identifier, default is 'supervisor') ;directory=/tmp ; (default is not to cd during start) ;nocleanup=true ; (don't clean up tempfiles at start;default false) ;childlogdir=/tmp ; ('AUTO' child log dir, default $TEMP) ;environment=KEY="value" ; (key value pairs to add to environment) ;strip_ansi=false ; (strip ansi escape codes in logs; def. false)

; the below section must remain in the config file for RPC ; (supervisorctl/web interface) to work, additional interfaces may be ; added by defining them in separate rpcinterface: sections [rpcinterface:supervisor] supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface

[supervisorctl] serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL for a unix socket ;serverurl=http://127.0.0.1:9001 ; use an http:// url to specify an inet socket ;username=chris ; should be same as http_username if set ;password=123 ; should be same as http_password if set ;prompt=mysupervisor ; cmd line prompt (default "supervisor") ;history_file=~/.sc_history ; use readline history if available

; The below sample program section shows all possible program subsection values, ; create one or more 'real' program: sections to be able to control them under ; supervisor. ;[program:theprogramname] ;command=/bin/cat ; the program (relative uses PATH, can take args) ;process_name=%(program_name)s ; process_name expr (default %(program_name)s) ;numprocs=1 ; number of processes copies to start (def 1) ;directory=/tmp ; directory to cwd to before exec (def no cwd) ;umask=022 ; umask for process (default None) ;priority=999 ; the relative start priority (default 999) ;autostart=true ; start at supervisord start (default: true) ;startsecs=1 ; # of secs prog must stay up to be running (def. 1) ;startretries=3 ; max # of serial start failures when starting (default 3) ;autorestart=unexpected ; when to restart if exited after running (def: unexpected) ;exitcodes=0,2 ; 'expected' exit codes used with autorestart (default 0,2) ;stopsignal=QUIT ; signal used to kill process (default TERM) ;stopwaitsecs=10 ; max num secs to wait b4 SIGKILL (default 10) ;stopasgroup=false ; send stop signal to the UNIX process group (default false) ;killasgroup=false ; SIGKILL the UNIX process group (def false) ;user=chrism ; setuid to this UNIX account to run the program ;redirect_stderr=true ; redirect proc stderr to stdout (default false) ;stdout_logfile=/a/path ; stdout log path, NONE for none; default AUTO ;stdout_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB) ;stdout_logfile_backups=10 ; # of stdout logfile backups (default 10) ;stdout_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default 0) ;stdout_events_enabled=false ; emit events on stdout writes (default false) ;stderr_logfile=/a/path ; stderr log path, NONE for none; default AUTO ;stderr_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB) ;stderr_logfile_backups=10 ; # of stderr logfile backups (default 10) ;stderr_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default 0) ;stderr_events_enabled=false ; emit events on stderr writes (default false) ;environment=A="1",B="2" ; process environment additions (def no adds) ;serverurl=AUTO ; override serverurl computation (childutils)

; The below sample eventlistener section shows all possible ; eventlistener subsection values, create one or more 'real' ; eventlistener: sections to be able to handle event notifications ; sent by supervisor.

;[eventlistener:theeventlistenername] ;command=/bin/eventlistener ; the program (relative uses PATH, can take args) ;process_name=%(program_name)s ; process_name expr (default %(program_name)s) ;numprocs=1 ; number of processes copies to start (def 1) ;events=EVENT ; event notif. types to subscribe to (req'd) ;buffer_size=10 ; event buffer queue size (default 10) ;directory=/tmp ; directory to cwd to before exec (def no cwd) ;umask=022 ; umask for process (default None) ;priority=-1 ; the relative start priority (default -1) ;autostart=true ; start at supervisord start (default: true) ;startsecs=1 ; # of secs prog must stay up to be running (def. 1) ;startretries=3 ; max # of serial start failures when starting (default 3) ;autorestart=unexpected ; autorestart if exited after running (def: unexpected) ;exitcodes=0,2 ; 'expected' exit codes used with autorestart (default 0,2) ;stopsignal=QUIT ; signal used to kill process (default TERM) ;stopwaitsecs=10 ; max num secs to wait b4 SIGKILL (default 10) ;stopasgroup=false ; send stop signal to the UNIX process group (default false) ;killasgroup=false ; SIGKILL the UNIX process group (def false) ;user=chrism ; setuid to this UNIX account to run the program ;redirect_stderr=false ; redirect_stderr=true is not allowed for eventlisteners ;stdout_logfile=/a/path ; stdout log path, NONE for none; default AUTO ;stdout_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB) ;stdout_logfile_backups=10 ; # of stdout logfile backups (default 10) ;stdout_events_enabled=false ; emit events on stdout writes (default false) ;stderr_logfile=/a/path ; stderr log path, NONE for none; default AUTO ;stderr_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB) ;stderr_logfile_backups=10 ; # of stderr logfile backups (default 10) ;stderr_events_enabled=false ; emit events on stderr writes (default false) ;environment=A="1",B="2" ; process environment additions ;serverurl=AUTO ; override serverurl computation (childutils)

; The below sample group section shows all possible group values, ; create one or more 'real' group: sections to create "heterogeneous" ; process groups.

;[group:thegroupname] ;programs=progname1,progname2 ; each refers to 'x' in [program:x] definitions ;priority=999 ; the relative start priority (default 999)

; The [include] section can just contain the "files" setting. This ; setting can list multiple files (separated by whitespace or ; newlines). It can also contain wildcards. The filenames are ; interpreted as relative to this file. Included files cannot ; include files themselves.

;[include] ;files = relative/directory/*.ini

[program:foo] command=/bin/cat

[program:foo2] command=/bin/cat

[program:tomcat] command=/Users/sagarw5/Documents/Setup/apache-tomcat-7.0.64/bin/startup.sh ; tail -f /Users/sagarw5/Documents/Setup/apache-tomcat-7.0.64/logs/catalina.out process_name=%(program_name)s autostart=true autorestart=true stopsignal=KILL

[program:tomcat2] command=/Users/sagarw5/Documents/Setup/apache-tomcat-7.0.64/bin/startup.sh ; tail -f /Users/sagarw5/Documents/Setup/apache-tomcat-7.0.64/logs/catalina.out process_name=%(program_name)s autostart=true autorestart=true stopsignal=KILL` As you can see above, supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface is enabled.

This is the command I am using to start supervisord: /usr/local/bin/supervisord -c /Users/sagarw5/Downloads/supervisor-3.2.3/supervisord.conf. According to the documentation, /usr/local/bin/ is $BINDIR.

Upon hitting that link, I get the following error: Error response

Error code 400.

Message: Bad Request.

What does that mean?

snigdhaAgarwal commented 8 years ago

However when I tried this via terminal, I am getting perfect response:

import xmlrpclib server = xmlrpclib.Server('http://sagarw5:123@127.0.0.1:9001/RPC2') server.supervisor.getState() The last line gives {'statename': 'RUNNING', 'statecode': 1}. Hence XML-RPC is enabled in supervisord.

cryptiklemur commented 8 years ago

Any update here? I'm getting the same issue

snigdhaAgarwal commented 8 years ago

I couldn't resolve it, so I moved to cesi. That worked fine, and got easily set up.

(P.S. No offence to creator intended)

mlazarov commented 8 years ago

Getting Error code 400. when accessing the RPC interface directly means that the rpc or the supervisor isn't configured correctly. That isn't related at all with supervisord-monitor and any configuration on supervisord-monitor can't solve this issue.

Anyone is free to use any software :)

spider4216 commented 8 years ago

I had such problem. After I specified url like "http://127.0.0.1/RPC2" in application/config/supervisor.php everything became fine! Thank you for tool

sstringer commented 8 years ago

I, too, am having this problem (XMLRPC's 127.0.0.1:9001/RPC2 returning an error code 400) and am unable to get supervisord-monitor working. I've been banging my head on my desk for hours and am about to give up. Note that 127.0.0.1:9001 works fine. Any advice would be much appreciated.

mlazarov commented 8 years ago

What is the PHP version that you are using?

sstringer commented 8 years ago

5.6.23. This is on a Ubuntu 14.04.5 LTS (GNU/Linux 3.13.0-71-generic x86_64) install.

Here's the full phpinfo dump in case it helps:

On Aug 5, 2016, at 2:53 AM, Martin Lazarov notifications@github.com wrote:

What is the PHP version that you are using?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/mlazarov/supervisord-monitor/issues/17#issuecomment-237780784, or mute the thread https://github.com/notifications/unsubscribe-auth/AA45oiGgNlhWEZnwBTzv5bJ7zuVxnDV5ks5qcuvjgaJpZM4Fl5hZ.

mlazarov commented 8 years ago

@sstringer , I can't see the phpinfo (may be because you are not using the online issue tracking but replaying to email). What is the version of supervisord that you are using? Also can you post the application/config/supervisor.php and /etc/supervisord.conf files?

sstringer commented 8 years ago

@mlazarov - I'm a total idiot. I gave you the info on the wrong server. This is an OS X 10.11.6 running PHP Version 5.5.26, and supervisord 3.2.1.

(In my defense, I have lots of servers.)

mlazarov commented 8 years ago

What about the application/config/supervisor.php and /etc/supervisord.conf files?

sstringer commented 8 years ago

Supervisor.php: http://pastebin.com/wPPGFKBR

I don't have a supervisord.conf file, but here's the ini file: /usr/local/etc/supervisord.ini: http://pastebin.com/RksEyqwS

mlazarov commented 8 years ago

Hm, I don't see any problem. Do you get any error when you open the supevisord monitoring web interface? btw just added you on skype so we can find the issue faster

sstringer commented 8 years ago

The supervisors monitoring web interface works: http://127.0.0.1:9001

Screenshot: https://www.evernote.com/l/AAPixGcYF7FBQYsKIj_nq-m-6CHvI1YS2Us

mlazarov commented 8 years ago

This is not the Supervisord monitoring project web interface. This is the Supervisor's web interface.

The "Supervisord-monitoring" web interface looks like this:

sstringer commented 8 years ago

Okay, after much fiddling, I finally got this to work. The trick was creating a /etc/supervisord.conf file and putting the following in it:

[inet_http_server]         ; inet (TCP) server disabled by default
port=127.0.0.1:9001

Thanks for your help, @mlazerov. Your question about the supervisors.conf file got me thinking.

banjocat commented 7 years ago

I ran into this "issue" but really it was just me not understanding how it works. Need to add /RPC2 in the config for each endpoint. Then it worked fine.