Live data from Hacker News

Using htop to generate a live website background

drunken-security.at

21–30 of 63 posts

Re: Using htop to generate a live website background

#23
post #6
post #4

Earlier quoted context omitted.

mysql at least replaces -ppassword for -px

Even though some software does replace the password, it would be better not to use passwords like that at all anyway. Just to be sure.

Once again with mysql you can:

    MYSQL_PWD=password mysql -uuser db

Re: Using htop to generate a live website background

#24
post #4

I would be worried about one of the processes having a database password or something like that as a parameter...

mysql at least replaces -ppassword for -px

There is a time interval larger than 0.000000000 seconds between the start of a mysql process and the process overwriting its argv :)

Re: Using htop to generate a live website background

#26
post #25

Not sure I understand why there's 4 nginx processes, 4 php-fpm processes and like 20 mysql processes, why so many, don't you need like 1 (or 4 if there' no pooling)?

That's worker threads, not processes. You can enable tree view in display options, then the worker threads would have been sorta moved to the right to indicate that fact, but that's not a default option.

Re: Using htop to generate a live website background

#27
Great idea! But wouldn't it be best to restrain the output of htop to a few interesting processes that are running without root privileges. It seems to me that it could be possible to bubble up processes that can leak information, especially at startup and when you put the server under load externally...

Re: Using htop to generate a live website background

#28
post #14
post #11

Well it's ansi text, so why not just copy the text directly to a DIV, convert the ansi to html (or css) and update it via javascript polling ?

You would have to parse the VT-100 escape codes to generate the correct html + css (e.g. colors and cursor relocation escape sequences). It is not that straight forward, but on the other hand there are libraries for that.

http://www.pixelbeat.org/scripts/ansi2html.sh

Re: Using htop to generate a live website background

#29
post #25

Not sure I understand why there's 4 nginx processes, 4 php-fpm processes and like 20 mysql processes, why so many, don't you need like 1 (or 4 if there' no pooling)?

That's worker threads, not processes. You can enable tree view in display options, then the worker threads would have been sorta moved to the right to indicate that fact, but that's not a default option.

Processes and threads are basically the same in Linux (except threads share resources, since we're talking about the same mysql "program" is a given that these are 'threads', sorry if I'm imprecise and call everything the same).

I'm no mysql expert but I highly doubt you need more than a few threads (a bunch for the db housekeeping and one per connection), looks like this server is not using pooling. Then again I don't know much about WP and I may be talking out of my behind.

Re: Using htop to generate a live website background

#30
I wrote a tiny program that captures the content of a Linux virtual console and prints it to stdout.[1] I forgot why I wrote it, but the source code shows how to access foreground color, background color and the font weight.[2] You could hack it to print everything in a format that's easily parsable, write it to a file every second and do the rendering on the client side with JavaScript.

[1] https://github.com/slyrz/peep/

[2] https://github.com/slyrz/peep/blob/master/peep.c#L165

Post reply on HN