mikaku / Monitorix

Monitorix is a free, open source, lightweight system monitoring tool.
https://www.monitorix.org
GNU General Public License v2.0
1.12k stars 167 forks source link

"Use of uninitialized value..." errors #162

Closed sebelk closed 8 years ago

sebelk commented 8 years ago

Hi,

Ihave the following errors:


HTTPServer: You can connect to your server at http://localhost:8080/
Use of uninitialized value $color in hash element at ./monitorix.cgi line 303.
Use of uninitialized value $when in pattern match (m//) at ./monitorix.cgi line 335.
Use of uninitialized value $val in string ne at ./monitorix.cgi line 430.
Use of uninitialized value $mode in string ne at ./monitorix.cgi line 430.
Use of uninitialized value $val in pattern match (m//) at ./monitorix.cgi line 438.
Use of uninitialized value $mode in string eq at ./monitorix.cgi line 451.
Use of uninitialized value $mode in string eq at ./monitorix.cgi line 451.
Use of uninitialized value $mode in string eq at ./monitorix.cgi line 453.
Use of uninitialized value $title in substitution (s///) at ./monitorix.cgi line 467.
Use of uninitialized value $title in concatenation (.) or string at ./monitorix.cgi line 468.
Use of uninitialized value $mode in string eq at ./monitorix.cgi line 493.
Use of uninitialized value $mode in string eq at ./monitorix.cgi line 516.
Use of uninitialized value $mode in string eq at ./monitorix.cgi line 518.
ERROR: writing to stdout: (32) Broken pipe
ERROR: writing to stdout: (32) Broken pipe
ERROR: writing to stdout: (32) Broken pipe

If I use the url with parameters works (e.g: http://192.168.6.13:8080/monitorix-cgi/monitorix.cgi?mode=localhost&graph=_squid&when=1day&color=black)

Permissions are:


[root@squid monitorix]# ls -ltr /var/lib/monitorix/
total 55716
drwxr-xr-x. 2 root root        6 nov 16  2015 usage
drwxr-xr-x. 2 root root     4096 sep 20 08:52 reports
drwxr-xr-x. 4 root root     4096 sep 20 08:52 www
-rw-r--r--. 1 root root  1825168 sep 20 09:30 serv.rrd
-rw-r--r--. 1 root root  1972664 sep 20 09:32 system.rrd
-rw-r--r--. 1 root root  3380144 sep 20 09:32 proc.rrd
-rw-r--r--. 1 root root  1691168 sep 20 09:32 kern.rrd
-rw-r--r--. 1 root root  5632112 sep 20 09:32 net.rrd
-rw-r--r--. 1 root root  6007440 sep 20 09:32 fs.rrd
-rw-r--r--. 1 root root  3380144 sep 20 09:32 netstat.rrd
-rw-r--r--. 1 root root  3380144 sep 20 09:32 port.rrd
-rw-r--r--. 1 root root   752848 sep 20 09:32 user.rrd
-rw-r--r--. 1 root root  4975288 sep 20 09:32 squid.rrd
-rw-r--r--. 1 root root 24023184 sep 20 09:32 int.rrd
[root@squid monitorix]# ls -ltr /var/lib/monitorix/www/
total 24
-rw-r--r--. 1 root   root   2251 mar 15  2013 monitorixico.png
-rw-r--r--. 1 root   root   4021 mar 15  2013 logo_top.png
-rw-r--r--. 1 root   root   1870 mar 15  2013 logo_bot.png
drwxr-xr-x. 2 root   root     52 sep 20 08:52 cgi
-rw-r--r--. 1 root   root   6169 sep 20 09:18 index.html
drwxr-xr-x. 2 nobody nobody 4096 sep 20 09:29 imgs

System info:

OS: CentOS Linux release 7.2.1511 (Core) monitorix-3.8.1-1.el7.noarch rrdtool-1.4.8-9.el7.x86_64 rrdtool-perl-1.4.8-9.el7.x86_64

It's a bit weird because I have the same version and the same OS on another host and I have no problems.

Any ideas?

sebelk commented 8 years ago

I've compiled from source and I have the same errors, please could you help me?

sebelk commented 8 years ago

I've found that for a reason that I can't understand only works on loopback:

tcpdump -i lo port 8080
07:12:43.248319 IP 192.168.6.13.38236 > 192.168.6.13.webcache: Flags [S], seq 384749532, win 43690, options [mss 65495,sackOK,TS val 889101197 ecr 0,nop,wscale 7], length 0
-22:-25:-32.292419 IP 192.168.6.13.webcache > 192.168.6.13.38236: Flags [S.], seq 3856187094, ack 384749533, win 43690, options [mss 65495,sackOK,TS val 889101197 ecr 889101197,nop,wscale 7], length 0

I have nothing on interfaz eth0, I mean only work on the same server running monitorix

Why does log say? HTTPServer: You can connect to your server at http://localhost:8080/

Most amazing is:

netstat -ntpa | grep 8080
tcp        0      0 0.0.0.0:8080            0.0.0.0:*               LISTEN      18172/monitorix-htt 

The section of builtin server:


<httpd_builtin>
    enabled = y
    host =
    port = 8080
    user = nobody
    group = nobody
    log_file = /var/log/monitorix-httpd
    hosts_deny =
    hosts_allow =
    <auth>
        enabled = n
        msg = Monitorix: Restricted access
        htpasswd = /var/lib/monitorix/htpasswd
    </auth>
</httpd_builtin>

Really don't understand...

iptables -L -vn
Chain INPUT (policy ACCEPT 149 packets, 43601 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain OUTPUT (policy ACCEPT 85 packets, 38987 bytes)
 pkts bytes target     prot opt in     out     source               destination  

Any ideas?

Thanks in advance!

mikaku commented 8 years ago

I'm sorry but I'm unable to understand what exactly is not working. Please, provide the URL you are using and with that you are experiencing problems. Thanks.

sebelk commented 8 years ago

Mikaku,

URL: http://192.168.6.13:8080/monitorix-cgi/monitorix.cgi

What is not working is the web pages of monitorix are broken if I try to access from a host distinct of the one that has monitorix running.

Only works if I submit with parameters, eg: http://192.168.6.13:8080/monitorix-cgi/monitorix.cgi?mode=localhost&graph=_squid&when=1day&color=black

otherwise it complains, (using builtin http server):

Wed Sep 21 14:11:50 2016 - Starting Monitorix version 3.8.1 (pid 49080).
Wed Sep 21 14:11:50 2016 - Loaded main configuration file '/etc/monitorix/monitorix.conf'.
Wed Sep 21 14:11:50 2016 - Initializing graphs.
Wed Sep 21 14:11:51 2016 - Generating the 'index.html' file.
Wed Sep 21 14:11:51 2016 - WARNING: the built-in HTTP server has authentication disabled.
HTTPServer: You can connect to your server at http://localhost:8080/
Wed Sep 21 14:11:51 2016 - Started built-in HTTP server (pid 49131).
Wed Sep 21 14:11:51 2016 - Ok, ready.
Use of uninitialized value $color in hash element at ./monitorix.cgi line 303.
Use of uninitialized value $when in pattern match (m//) at ./monitorix.cgi line 335.
Use of uninitialized value $val in string ne at ./monitorix.cgi line 438.
Use of uninitialized value $mode in string ne at ./monitorix.cgi line 438.
Use of uninitialized value $val in pattern match (m//) at ./monitorix.cgi line 446.
Use of uninitialized value $mode in string eq at ./monitorix.cgi line 459.
Use of uninitialized value $mode in string eq at ./monitorix.cgi line 459.
Use of uninitialized value $mode in string eq at ./monitorix.cgi line 461.
Use of uninitialized value $title in substitution (s///) at ./monitorix.cgi line 475.
Use of uninitialized value $title in concatenation (.) or string at ./monitorix.cgi line 476.
Use of uninitialized value $mode in string eq at ./monitorix.cgi line 501.
Use of uninitialized value $mode in string eq at ./monitorix.cgi line 524.
Use of uninitialized value $mode in string eq at ./monitorix.cgi line 526.

But as I told earlier, firewalld is disabled, no iptables rules, policy accept

What's wrong?

mikaku commented 8 years ago

URL: http://192.168.6.13:8080/monitorix-cgi/monitorix.cgi

That URL incomplete as it lacks the corresponding parameters.

Only works if I submit with parameters, eg: http://192.168.6.13:8080/monitorix-cgi/monitorix.cgi?mode=localhost&graph=_squid&when=1day&color=black

That's perfectly normal, most programs don't run correctly or generate errors if the parameters supplied are invalid.

What's wrong?

The URL.

sebelk commented 8 years ago

The proble is that page is broken...

I've attached a screenshot with the problem when access from another host monitorix-problem-github

Thanks in advance!

mikaku commented 8 years ago

Again, that looks like a wrong URL. Did you reached to that page after pressing the OK button?

sebelk commented 8 years ago

What is the right url? I get the same if I remove the trailing "?"

sebelk commented 8 years ago

Oh, sorry shame and shame on me!!!

I've found that right url is http://192.168.6.13:8080/monitorix/ The trailing "/" is important!

Thanks!