Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

Tuesday, September 24, 2019

Puppet sandbox


In order to check your puppet script in a sandox, go to any linux server and create the following directory structure:



Create dir


/tmp/mypuppet/


Under this directory 


./modules./modules/test./modules/test/templates./modules/test/templates/test.erb./modules/test/manifests./modules/test/manifests/init.pp



Here's your manifest: 
./test.pp

puppet apply --modulepath /tmp/mypuppet/modules test.pp

In my example , this was the manifest:

test.pp :
node qtvr-wto134 {class { 'test::config': }
} 

the modules modules/test/manifests/init.pp :


class test::config ($routingRulesList = ['zzffline1', 'zzffline2', 'zzffline3'],) {
file { "/home/michael_puppet_sandbox/mypuppet/locations.include":ensure => present,content => template("test/test.erb"),}
}

 and the template modules/test/templates/test.erb :
<% @routingRulesList.each do |routingRule| -%><%=routingRule%><% end %>


and then click on

 puppet apply --modulepath /tmp/mypuppet/modules .  test.pp 


The command puppet apply --modulepath /tmp/mypuppet/modules . test.pp  will create the following output file :



puppet apply --modulepath /tmp/mypuppet/modules . test.pp
zzffline1zzffline2zzffline3

Thursday, March 8, 2018

for loop example - for remote ssh

instead of mcollective:

for server in qtvr-els03  qtvr-els04  qtvr-els05  qtor-els601  qtor-els602  qtor-els603  qtvr-els005  qtvr-els0029 ; do ssh root@$server "hostname; /etc/init.d/elasticsearch status "; done


Or also
for server in `zoom --HF lpcluster=z2_elasticsearch_agent_manager_01 -f hostname`; do ssh $server 'echo $HOSTNAME'; done;



in another word:

for server in server1 server2 server3 ; do ssh root@$server "hostname; echo do something"; done


Very useful!

Thursday, July 20, 2017

Socat - a Simple Tcp Proxy

In order to setup a simple TCP proxy, I've used the following :

yum install socat

socat TCP4-LISTEN:2003,fork TCP4:app.graphite.lpdomain.com:2003


This listen to port 2003 and send everything to the remote server app.graphite.lpdomain.com , to remote port 2003

I've done that in order to be able to send metric value to a remote graphite server that was not accessible from my server.
In order to send value to graphite , I've used the following :


echo Centralized.service.sandbox.test3   1234  `date +%s --date='30 minutes ago'` | nc -v my-proxy-server 2003


BTW, I was also suggested to use nc command, but it appears that this proxy tool is more primitive and doesn't support multiple connection apparently :

mkfifo backpipe
nc -k -l 2003    <backpipe | nc app.graphite.lpdomain.com 2003  1>backpipe 

Tuesday, July 14, 2015

how to fix the RPM stuck problem

how to fix the RPM stuck problem 
when running rpm -qa |grep something , then it gets stuck forever ...

It's problably due to the a huge number of RPM process ...

I was suggested to do the following: 
  • ps -ef|grep rpm |awk '{print $2}' | xargs kill -9
  • cd /var/lib/rpm/
  • ls
  • rm -f  __*


Other related links: 
http://unix.stackexchange.com/questions/166966/rpm-command-stuck-freeze-when-installing-rpm-file



rpm may be waiting for a lock to be freed.
First, run ps -ef | grep rpm to see if you have any RPM commands running. If you do, kill them using kill -9.
Next, delete any leftover locks rm -rf /var/lib/rpm/__db.0*

Tuesday, June 23, 2015

NFS and Shared Folder creation between servers


Install NFS on all your servers

yum install nfs-utils -y
service rpcbind start
service nfs start
service autofs restart

NFS server side

Then, in your "NFS server", create the shared folder (aka the folder to be shared)

mkdir /home/mich/SHARED_FOLDER
chmod a+w /home/mich/SHARED_FOLDER



Define the mount folder:

vi /etc/exports /home/mich/SHARED_FOLDER 192.168.1.0/24(rw,sync,no_root_squash,no_all_squash)
where the  192.168.1.0/24 is the IP range of the servers authorized to access this mounted folders

In order to make the export change effective, type:
exportfs -a

then, do not forget to start nfs
/etc/init.d/nfs start

or even to start it automatically in startup:
for ex:

cat /etc/rc.d/rc.local 

#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
depmod -a
modprobe acpiphp
if [ -f /etc/rc.firstboot ]
then
        /etc/rc.firstboot | tee /var/log/firstboot.log
        cp /etc/rc.firstboot /usr/local/etc/
        rm /etc/rc.firstboot
        reboot
fi
touch /var/lock/subsys/local
/etc/init.d/nfs start

NFS CLIENT side


Then, on each client side, that want to use this mount :


mkdir /nfs/shared
mount -t nfs 192.168.20.11:/home/mich/SHARED_FOLDER/ /nfs/shared/


where 192.168.20.11 is the IP of the NFS server that you've configured in the previous paragraph

or do it automatically after startup:
vi /etc/fstab

add something like:
192.168.20.11:/home/mich/SHARED_FOLDER/ /nfs/shared/  nfs rsize=8192,wsize=8192,timeo=14,intr

if you want to test it without reboot your machine, do simply
mount -a

All those instructions were freely and quite fully inspired from this link:


Thursday, March 12, 2015

Network Connection

In order to understand the spec of the network card being used by your server:

lspci | grep -i net

Here, as example of the status on my job's cloud : 


ro -a -o . -h els2 -s shared -irc %/ lspci | grep -i net
[ virginia / svpr-els204 ] - 03:00.0 Ethernet controller: Broadcom Corporation NetXtreme BCM5719 Gigabit Ethernet PCIe (rev 01)        <<== which means 1 GB only
[ virginia / svpr-els204 ] - 03:00.1 Ethernet controller: Broadcom Corporation NetXtreme BCM5719 Gigabit Ethernet PCIe (rev 01)
[ virginia / svpr-els204 ] - 03:00.2 Ethernet controller: Broadcom Corporation NetXtreme BCM5719 Gigabit Ethernet PCIe (rev 01)
[ virginia / svpr-els204 ] - 03:00.3 Ethernet controller: Broadcom Corporation NetXtreme BCM5719 Gigabit Ethernet PCIe (rev 01)
[ virginia / svpr-els205 ] - 03:00.0 Ethernet controller: Broadcom Corporation NetXtreme BCM5719 Gigabit Ethernet PCIe (rev 01)
[ virginia / svpr-els205 ] - 03:00.1 Ethernet controller: Broadcom Corporation NetXtreme BCM5719 Gigabit Ethernet PCIe (rev 01)
[ virginia / svpr-els205 ] - 03:00.2 Ethernet controller: Broadcom Corporation NetXtreme BCM5719 Gigabit Ethernet PCIe (rev 01)
[ virginia / svpr-els205 ] - 03:00.3 Ethernet controller: Broadcom Corporation NetXtreme BCM5719 Gigabit Ethernet PCIe (rev 01)
[ virginia / svpr-els206 ] - 03:00.0 Ethernet controller: Broadcom Corporation NetXtreme BCM5719 Gigabit Ethernet PCIe (rev 01)
[ virginia / svpr-els206 ] - 03:00.1 Ethernet controller: Broadcom Corporation NetXtreme BCM5719 Gigabit Ethernet PCIe (rev 01)
[ virginia / svpr-els206 ] - 03:00.2 Ethernet controller: Broadcom Corporation NetXtreme BCM5719 Gigabit Ethernet PCIe (rev 01)
[ virginia / svpr-els206 ] - 03:00.3 Ethernet controller: Broadcom Corporation NetXtreme BCM5719 Gigabit Ethernet PCIe (rev 01)
[ virginia / svpr-els207 ] - 04:00.0 Ethernet controller: Emulex Corporation OneConnect 10Gb NIC (be3) (rev 01)             <<== this means the card is 10Gb/sec 
[ virginia / svpr-els207 ] - 04:00.1 Ethernet controller: Emulex Corporation OneConnect 10Gb NIC (be3) (rev 01)
[ virginia / svpr-els208 ] - 04:00.0 Ethernet controller: Emulex Corporation OneConnect 10Gb NIC (be3) (rev 01)
[ virginia / svpr-els208 ] - 04:00.1 Ethernet controller: Emulex Corporation OneConnect 10Gb NIC (be3) (rev 01)
[ virginia / svpr-els209 ] - 04:00.0 Ethernet controller: Emulex Corporation OneConnect 10Gb NIC (be3) (rev 01)
[ virginia / svpr-els209 ] - 04:00.1 Ethernet controller: Emulex Corporation OneConnect 10Gb NIC (be3) (rev 01)
[ virginia / svpr-els21 ] - 04:00.0 Ethernet controller: Emulex Corporation OneConnect 10Gb NIC (be3) (rev 01)
[ virginia / svpr-els21 ] - 04:00.1 Ethernet controller: Emulex Corporation OneConnect 10Gb NIC (be3) (rev 01)
[ virginia / svpr-els210 ] - 04:00.0 Ethernet controller: Emulex Corporation OneConnect 10Gb NIC (be3) (rev 01)
[ virginia / svpr-els210 ] - 04:00.1 Ethernet controller: Emulex Corporation OneConnect 10Gb NIC (be3) (rev 01)
[ virginia / svpr-els211 ] - 04:00.0 Ethernet controller: Emulex Corporation OneConnect 10Gb NIC (be3) (rev 01)
[ virginia / svpr-els211 ] - 04:00.1 Ethernet controller: Emulex Corporation OneConnect 10Gb NIC (be3) (rev 01)
[ virginia / svpr-els212 ] - 04:00.0 Ethernet controller: Emulex Corporation OneConnect 10Gb NIC (be3) (rev 01)
[ virginia / svpr-els212 ] - 04:00.1 Ethernet controller: Emulex Corporation OneConnect 10Gb NIC (be3) (rev 01)
[ virginia / svpr-els22 ] - 04:00.0 Ethernet controller: Emulex Corporation OneConnect 10Gb NIC (be3) (rev 01)
[ virginia / svpr-els22 ] - 04:00.1 Ethernet controller: Emulex Corporation OneConnect 10Gb NIC (be3) (rev 01)


In addition, in order to understand the SWAP memory usage :

free -g 


 free -g             total       used       free     shared    buffers     cachedMem:           125        110         15          0          3         67-/+ buffers/cache:         39         86Swap:          128          0        128


==> Means that the OS has about 67+15 GB available

If you don't want to use swap (it may slow your server/application etc) 


  • swapoff -a   ==> do never use swap
  • sysctl vm.swappiness=0   ==> use swap only if you don't have any more choice
  • sysctl vm.swappiness=60   ==> use swap only if you reach more than 60% of the memory
  • swapon -a ==> enable usage of SWAP, according to the swappiness value 
  •  sysctl -a |grep swap  : to understand what is the % policy value.


Using top, you can have the following:

Mem:  132119828k total, 131341592k used,   778236k free,  3505520k buffers
Swap: 134365176k total,    88752k used, 134276424k free, 105451036k cached  <<== this is the FULL RAM available

More info regarding swap can be found: 
http://askubuntu.com/questions/103915/how-do-i-configure-swappiness


Tuesday, February 24, 2015

How to characterize stength of a server

In order to understand your server, what is its strenght, its OS version, how many cpu, here is a short list of commands that may help



free -m
             total       used       free     shared    buffers     cached
Mem:          3832       3605        226          0        375       1038
-/+ buffers/cache:       2192       1640
Swap:         4031        126       3905

In this case, we can see the server has about 4GB RAM .



top  (and then click on 1)

top - 18:26:24 up 169 days,  7:07,  3 users,  load average: 0.03, 0.08, 0.08
Tasks: 133 total,   1 running, 130 sleeping,   0 stopped,   2 zombie
Cpu0  :  2.9%us,  0.7%sy,  0.0%ni, 95.9%id,  0.5%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu1  :  1.4%us,  0.5%sy,  0.0%ni, 97.5%id,  0.6%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   3924684k total,  3658548k used,   266136k free,   380324k buffers
Swap:  4128760k total,   130752k used,  3998008k free,  1035372k cached

Here, we can see that we have 2 CPU (2 core) and still about 4 GB RAM


df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_root-lv_root
                       20G  5.1G   14G  27% /
tmpfs                 1.9G     0  1.9G   0% /dev/shm
/dev/sda1             146M   60M   79M  44% /boot
/dev/mapper/vg_root-lv_home
                      4.0G  137M  3.7G   4% /home
/dev/mapper/vg_root-lv_liveperson
                       28G  987M   26G   4% /liveperson
/dev/mapper/vg_root-lv_tmp
                      4.0G  143M  3.6G   4% /tmp

This command enables to understand the disk partition ... How many storage you have etc ,,,


cat /etc/issue
CentOS release 6.6 (Final)
Kernel \r on an \m

This last command shows you which OS you run on and what is its version.
Here, we use CentOS version 6.6 release.

Monday, June 2, 2014

vi macro - tip

I always wanted to know that: macro on vi ...




Instructions: To enter a macro, type:
q<letter><commands>q
To execute the macro <number> times (once by default), type:
<number>@<letter>


Example: So, the complete process looks like:
qdstart recording to register d
...your complex series of commands
qstop recording

Then, for re-executing the macro :

@dexecute your macro
@@execute your macro again

Monday, November 4, 2013

LogRotate in unix - Utility for rotation of files (i.e log files ) in unix

I've just learned that this utility exists in linux / unix

Logrotate is a great utility to manage and adminster log files in a system. It provides you with a lot of options, namely, automatic rotation, compression and mailing of log files. Each log file can be rotated hourly, daily, weekly or monthly. In this article, I will show you how to manage your log files using logrotate.

You can add your own configuration file like /etc/logrotate.d/LPapache which defines which files should be rotated.

Example of configuration file:

/etc/logrotate.d/LPapache
/liveperson/data/server_tomcat/logs/*txt /liveperson/data/server_tomcat/logs/*log /liveperson/data/server_tomcat/logs/catalina.out {
    copytruncate
    daily
    rotate 365
    missingok
    dateext
    sharedscripts
    compress
}



Another example /etc/logrotate.d/LPapache:
/liveperson/data/server_apache/logs/*log {
    rotate 365
    missingok
    size 500M
    dateext
    sharedscripts
    compress
    postrotate
        /sbin/service LPapache reload > /dev/null 2>/dev/null || true
    endscript
}

More info here
  http://linuxers.org/howto/howto-use-logrotate-manage-log-files  

Wednesday, June 5, 2013

Query RPM

Some RPM commands that I regularly use (and struggle to find their syntax)


In order to query which RPM is installed on your machine
rpm -qa |grep somthing

Query a specific RPM installed on your machine:
rpm -qil nameOfYouPackage

Same but for RPM that is not installed on your machine (
rpm -qpil  nameOfYouPackage.rpm

Erase an installed RPM
rpm -e NameOfYourPackage
Search for availability of a package in the yum repositories:
 yum list stingraymain



Some Yum commands en vrac
yum search YourYumPackage
yum install YourYumPackage
yum remove YourYumPackage
yum info  YourYumPackage






Tuesday, March 5, 2013

java.net.SocketException: Too many open files

I've recently experienced this bad exception in my linux machine, during load test I've launched
java.net.SocketException: Too many open files

After some google search + consultation with my colleague in production, I've learned the following:

Type
ulimit -a

[root@tlvcib7 ~]# ulimit -a

core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 62827
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 256pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 10240
cpu time               (seconds, -t) unlimited
max user processes              (-u) 1024
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

This means that I'm allowed to open up to 256 file descriptors.

In order to modify it, in your own shell, do the following
ulimit -n  65536  
from then, in your own shell, you'll have the limit set to 65536 (64*1024)

You can also define it in
/etc/security/limits.conf


For everyone
*       hard    nproc           65536
*        soft    nproc           65536

or more specifically for a given user

@student        hard    nproc           20
@faculty        soft    nproc           20

or as implemented in Shark @ LP (somehow, the above lines didn't do what I expected )

root hard nofile 32768
web hard nofile 32768

root soft nofile 32768
root soft nproc 32768
web soft nproc 32768
web soft nofile 32768
web          -    nofile          32768




The file descriptor being used are in
/proc/<pid>/fd/

For ex, if your java process is 13336


 ls /proc/13336/fd0    105  112  12   127  134  141  149  156  163  170  178  185  192  2    206  213  220  228  235  242  25   259  27  34  41  49  56  63  70  78  85  921    106  113  120  128  135  142  15   157  164  171  179  186  193  20   207  214  221  229  236  243  250  26   28  35  42  5   57  64  71  79  86  9310   107  114  121  129  136  143  150  158  165  172  18   187  194  200  208  215  222  23   237  244  251  260  29  36  43  50  58  65  72  8   87  94100  108  115  122  13   137  144  151  159  166  173  180  188  195  201  209  216  223  230  238  245  252  261  3   37  44  51  59  66  73  80  88  95101  109  116  123  130  138  145  152  16   167  174  181  189  196  202  21   217  224  231  239  246  253  262  30  38  45  52  6   67  74  81  89  96102  11   117  124  131  139  146  153  160  168  175  182  19   197  203  210  218  225  232  24   247  254  263  31  39  46  53  60  68  75  82  9   97103  110  118  125  132  14   147  154  161  169  176  183  190  198  204  211  219  226  233  240  248  255  264  32  4   47  54  61  69  76  83  90  98104  111  119  126  133  140  148  155  162  17   177  184  191  199  205  212  22   227  234  241  249  258  266  33  40  48  55  62  7   77  84  91  99


Sunday, February 10, 2013

NVidia and Ubuntu / Mint crash

Recently, I've re-install my desktop with ubuntu 12.10 , 12.05 and also with Mint 14.1.
But it didn't work ... The installation, for all the OS, was very smooth and intuitive.
But the system was unstable and one of the symptom was that my Firefox did crash and caused a crash of my login session each time I tried to start it (it happened on ubuntu 12.10 and on mint 14.1)

After some google search, I think the reason was of the NVidia graphic driver , which was badly buggy.

I've re-install it using these instructions found here http://askubuntu.com/questions/192025/ubuntu-12-04-terminal-only-after-nvidia-driver-upgrade
  • Remove all the nVidia drivers that you installed.
sudo apt-get --purge remove nvidia-*
  • Install the drivers again:
sudo add-apt-repository ppa:ubuntu-x-swat/x-updates
sudo apt-get update
sudo apt-get install nvidia-current nvidia-settings


On my Mint 14.1 at least, it helped. I don't know yet about ubuntu ...

Monday, November 19, 2012

How to synchronize clock between time

In order to synchronize the clock time between servers, you must have one reference server. In our example tlvntp1.tlv.lpnet.com
Then, all your server should refer to it . That's the way to do it:

1) In your file /etc/ntp.conf, you should have the following line:

server tlvntp1.tlv.lpnet.com
My System Administrator did the following shortcut:
echo server tlvntp1.tlv.lpnet.com > /etc/ntp.conf

But be careful with it, since it may delete other synchronization option the file already has.


2) To be synchronized with our IT ntpserver (the one with the good clock time)
service ntpd restart

3) Then ntpq -p
to display what the offset with the synchronized server  (the tlvntp1) 
The offset should reduce after few minutes ....

This apparently means what is the offset between your current server and the referenced ntp server ( here, for ex, rstm02 and rstm18 etc ...)
michaelz@roor-wto128:~$ ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
+rstm02.lpdomain 64.236.96.53     2 u  162 1024  377    0.320    4.600   0.049
+rstm18.lpdomain 204.9.54.119     2 u  150 1024  377    0.337    5.579   0.063
*rstm09.lpdomain 64.236.96.53     2 u  173 1024  377    0.358    1.196   0.035
 rstm07.lpdomain 172.16.22.71     2 u  551 1024  377    0.777  -42.128   3.369
 rstm06.lpdomain 172.16.22.71     2 u  884 1024  377    2.675  -94.770  96.884


Same, but without host name resolving (-n option)
michaelz@roor-wto128:~$ ntpq -pn
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
+10.16.23.11     64.236.96.53     2 u  168 1024  377    0.320    4.600   0.049
+10.16.22.18     204.9.54.119     2 u  156 1024  377    0.337    5.579   0.063
*10.16.23.21     64.236.96.53     2 u  179 1024  377    0.358    1.196   0.035
 10.16.22.61     172.16.22.71     2 u  557 1024  377    0.777  -42.128   3.369
 10.16.22.71     172.16.22.71     2 u  890 1024  377    2.675  -94.770  96.884


4) Synchronize time between two servers
In order to synchronize the time between two different servers (no need to have an ntp server in between):

ntpdate -u the-second-host-server





To synchronize your Windows with an external NTP server, do the following:
net time \\tlvdc1 /set /y    
where, tlvdc1 is the host  name of yoru NTP server

Monday, October 29, 2012

Change background color in linux/unix terminal xterm

 Useful link for modifying the background color.
Especially useful when working with multiple terminal, on different machines ...


http://unix.stackexchange.com/questions/16120/in-bash-how-can-i-change-the-color-of-my-command-prompt

Put in your ~/.bashrc

# Color mapping
grey='\[\033[1;30m\]'
red='\[\033[0;31m\]'
RED='\[\033[1;31m\]'
green='\[\033[0;32m\]'
GREEN='\[\033[1;32m\]'
yellow='\[\033[0;33m\]'
YELLOW='\[\033[1;33m\]'
purple='\[\033[0;35m\]'
PURPLE='\[\033[1;35m\]'
white='\[\033[0;37m\]'
WHITE='\[\033[1;37m\]'
blue='\[\033[0;34m\]'
BLUE='\[\033[1;34m\]'
cyan='\[\033[0;36m\]'
CYAN='\[\033[1;36m\]'
NC='\[\033[0m\]'
Step 2. Re-define your PS1 variable:
PS1="$yellow[$CYAN\t$yellow][$red\H$yellow][$GREEN\w$grey$yellow]$NC# "
 
 
 or more details also can be found here:
 
https://wiki.archlinux.org/index.php/Color_Bash_Prompt
 

Prompt escapes

The various Bash prompt escapes listed in the manpage:
Bash allows these prompt strings to be customized by inserting a number of backslash-escaped special characters that are decoded as follows: \a an ASCII bell character (07) \d the date in "Weekday Month Date" format (e.g., "Tue May 26") \D{format} the format is passed to strftime(3) and the result is inserted into the prompt string an empty format results in a locale-specific time representation. The braces are required \e an ASCII escape character (033) \h the hostname up to the first `.' \H the hostname \j the number of jobs currently managed by the shell \l the basename of the shell's terminal device name \n newline \r carriage return \s the name of the shell, the basename of $0 (the portion following the final slash) \t the current time in 24-hour HH:MM:SS format \T the current time in 12-hour HH:MM:SS format \@ the current time in 12-hour am/pm format \A the current time in 24-hour HH:MM format \u the username of the current user \v the version of bash (e.g., 2.00) \V the release of bash, version + patch level (e.g., 2.00.0) \w the current working directory, with $HOME abbreviated with a tilde \W the basename of the current working directory, with $HOME abbreviated with a tilde \! the history number of this command \# the command number of this command \$ if the effective UID is 0, a #, otherwise a $ \nnn the character corresponding to the octal number nnn \\ a backslash \[ begin a sequence of non-printing characters, which could be used to embed a terminal control sequence into the prompt \] end a sequence of non-printing characters
 

Thursday, September 13, 2012

XMing + Putty for remote desktop on ubuntu

Well, I didn't work with Remote Desktop but I was told (Omri) that I can work instead with specific remote application, using XMing + Putty.

Explanation there:
http://www.math.umn.edu/systems_guide/putty_xwin32.html


In few word, start XMing server.
Then, run putty and configure your SSH session to your remote desktop / ubuntu use X-Forwarding.

Then, the putty console can open XTerm and all other graphics ...

Sunday, July 1, 2012

Connect to jconsole to a remote server

Recently, I've encountered problem for connecting jconsole to my remote server (it was tomcat server). Locally, it did work but remotely, it didn't,
I used JDK 1.7 (it may be linked ... ) and ubuntu (it may be linked also).

So I've added the following property:
-Djava.rmi.server.hostname=michael-ubu 


and it started working ...

Here's the doc that finally helped me:

http://docs.oracle.com/javase/7/docs/technotes/guides/rmi/javarmiproperties.html


java.rmi.server.hostname
The value of this property represents the host name string that should be associated with remote stubs for locally created remote objects, in order to allow clients to invoke methods on the remote object. The default value of this property is the IP address of the local host, in "dotted-quad" format.






This one also helped me:

I had a similar, if not the same, problem. I could connect to the JMX server if I started jconsole locally on the machine.
It appears the RMI server was not listening on the correct ip. So, as was suggested in this related question, I added the following:
-Djava.rmi.server.hostname=<host ip>
to JAVA_OPTS as well, and then it worked.



Sunday, June 10, 2012

Remote desktop to Ubuntu

I struggle a lit for accessing my Ubuntu desktop from a windows computer.
I use team viewer which gives a full solution, that overcomes the con security wall .
But I also discovered recently the realvnc viewer, which is quite fast and precise, and requires only a simple executable without installation.

Monday, June 4, 2012

Ubuntu linux Remove Global AppMenu

In order to remove the Global AppMenu on the top screen and have the window standard app menu on the top of each window, do the following:

sudo apt-get remove indicator-appmenu


There's also way to remove the global menu for specific application only (i.e only for firefox , idea etc ...)

Thursday, May 24, 2012

IDEA JetBrain intellij

I started using IDEA instead of eclipse ...
First impressions:
I don't like their GUI
I do like their integration with spring/tomcat/everything ...
I do like the fastness in search ...

Some tip for newbies and for ubuntu / linux user:

1) when clicking on Switch-Tab for moving between application, I don't see the IDEA icon.
Solution: http://devnet.jetbrains.net/thread/435242


intellij-launcher.png

Please remove your launcher, start IDEA from a terminal, invoke a Tools | Create Desktop Entry action, exit IDEA, and restart session. After that you'll have a correct main menu entry which displays right icon in a switcher and is pinnable to Unity launcher.






2) Good link for better navigation in IDEA:

like here:

Quick switch of the current scheme

screenshot
There is no need to dig deep into the settings dialogs hierarchy when you need to apply another Color/Code style Scheme, Keymap or even Look and Feel of the application. This can be achieved with a short series of shortcuts. Just press Ctrl + BackQuote and then the number of the scheme to change.

Tuesday, May 22, 2012

Ubuntu background color problem

Periodically, when upgrading Ubuntu, I have this background color problem, where for ex my eclipse open popup with a black color background, so I can't read the tooltip content.

I found a solution here.
In my words:

go to /usr/share/themes/Ambiance/gtk-2.0/gtkrc 
and replace #000000 by #f5f5b5

http://askubuntu.com/questions/70599/how-to-change-tooltip-background-color-in-unity


I had to edit these files:
/usr/share/themes/Ambiance/gtk-3.0/settings.ini
/usr/share/themes/Ambiance/gtk-3.0/gtk.css
/usr/share/themes/Ambiance/gtk-2.0/gtkrc
(Addition: for Ubuntu 12.04, it seems youjust have to modify the file: /usr/share/themes/Ambiance/gtk-2.0/gtkrc , replacing the tooltip backround and foreground color, with the #000000 and the #f5f5b5 color, respectively)
You require root privileges to edit the files. Use sudo gedit to edit them.
Search for tooltip in these files and you'll find the color definitions for the foreground and the background. I use #000000 as foreground and #f5f5b5 as background and now the tooltips in all applications are again readable. After changing the color values simply switch to some other theme and then back to Ambiance and the tooltip color is now fixed.