20160103

Быстрые заметки по FireFox

3. Базовый набор плагинов.
habrahabr.ru/post/195052/
Adblock Plus
NoScript
Cookie Monster
Download YouTube Videos as MP4
 

2. Приватный рехим при старте FF.
2.1 kostya@aee:~$ firefox --private --no-remote
2.2 kostya@aee:~$ firefox -P newprofile1 --no-remote
about:config
browser.privatebrowsing.autostart -> true

Визуально понять, что находишься в приватном режиме можно только с помощью мемменджера "Firefox Hello", иконка будет в виде пустого облачка разговора.

1. Создание и запуск нового профиля.
Что бы запустить меню где можно сделать еще один профиль даем команду:
kostya@aee:~$ firefox -P

Запусть новый профиль:
kostya@aee:~$ firefox -P newprofile1 --no-remote

20151203

Быстрые заметки по awk


2. Отформатировать список адресов под junos address-book.
Есть список ip-адресов и имен серверов:

$ cat TEST-SERV-LOW
192.168.1.1;server1
192.168.1.2;server2
192.168.1.3;server3
192.168.1.4;server4

Этот список надо быстро добавить через "load set relative" в address-book.
Делаем address и address-set.

-- Поменяем регистр имен:
$ tr [:lower:] [:upper:] <TEST-SERV-LOW> TEST-SERV-UP
$ cat TEST-SERV-UP
192.168.1.1;SERVER1
192.168.1.2;SERVER2
192.168.1.3;SERVER3
192.168.1.4;SERVER4

-- С помощью awk печатаем команды:
$ awk -F ';' '{ print "set address " $2 " " $1}'  TEST-SERV-UP > server-set-load | awk -F ';' '{print "set address-set SET-SERVER-IP " $2}' TEST-SERV-UP >> server-set-load

$ cat server-set-load
set address SERVER1 192.168.1.1
set address SERVER2 192.168.1.2
set address SERVER3 192.168.1.3
set address SERVER4 192.168.1.4
set address-set SET-SERVER-IP SERVER1
set address-set SET-SERVER-IP SERVER2
set address-set SET-SERVER-IP SERVER3
set address-set SET-SERVER-IP SERVER4



1. Сумма чисел.

Есть вот такой лог, файл test1:
[18/Nov/2015 21:18:03] {pktdrop} Last message repeated 4 times
[18/Nov/2015 21:18:03] {pktdrop} Last message repeated 3 times
[18/Nov/2015 21:18:03] {pktdrop} Last message repeated 13 times
[18/Nov/2015 21:18:03] {pktdrop} Last message repeated 8 times
[18/Nov/2015 21:18:03] {pktdrop} Last message repeated 3 times

Надо посчитать сколько раз повторялось сообщение.

В качестве разделителя используется пробел, числа которые надо сложить находятся в 7-й переменной.

Что бы вывести только эти числа даем команду:
[k@redpc ~]$ awk -F ' ' '{print $7}' test1
4
3
13
8
3

Суммируем эти числа:
[k@redpc ~]$ awk -F ' ' '{print $7}' test1 | awk '{ x += $0 } END {print x}'
31

или можно сразу так:
[k@redpc ~]$  awk '{ x += $7 } END {print x}' test1
31


20150903

Установка VMwareTools на Centos.

1. Включаем ВМ.

2. Подключаем из esxi клиента образ с vmwaretools.
Правой кнопкой мыши по ВМ -> Guest -> Install/Upgrade VMware Tools

3. Монтируем cdrom с образом.
root@sbc2 ~
# mount /dev/cdrom /mnt
mount: block device /dev/sr0 is write-protected, mounting read-only

root@sbc2 ~
# ll /mnt/
total 62915
-r-xr-xr-x 1 root root     1970 Aug 22  2014 manifest.txt
-r-xr-xr-x 1 root root     1850 Aug 22  2014 run_upgrader.sh
-r--r--r-- 1 root root 63024310 Aug 22  2014 VMwareTools-9.4.10-2068191.tar.gz
-r-xr-xr-x 1 root root   693484 Aug 22  2014 vmware-tools-upgrader-32
-r-xr-xr-x 1 root root   702400 Aug 22  2014 vmware-tools-upgrader-64

4. Распаковываем архив. 
root@sbc2 ~ 
# mkdir vmtool

root@sbc2 ~ 
# cd vmtool/

root@sbc2 vmtool 
# tar zxpf /mnt/VMwareTools-9.4.10-2068191.tar.gz 

root@sbc2 vmtool 
# ll
total 4
drwxr-xr-x 7 root root 4096 Aug 22  2014 vmware-tools-distrib

root@sbc2 vmtool 
# cd vmware-tools-distrib/
root@sbc2 vmware-tools-distrib 
# ll
total 480
drwxr-xr-x  2 root root   4096 Aug 22  2014 bin
drwxr-xr-x  2 root root   4096 Aug 22  2014 doc
drwxr-xr-x  5 root root   4096 Aug 22  2014 etc
-rw-r--r--  1 root root 265487 Aug 22  2014 FILES
-rw-r--r--  1 root root   2538 Aug 22  2014 INSTALL
drwxr-xr-x  2 root root   4096 Aug 22  2014 installer
drwxr-xr-x 14 root root   4096 Aug 22  2014 lib
-rwxr-xr-x  1 root root 197302 Aug 22  2014 vmware-install.pl

5. Ставим. На все вопросы отвечаем по дефолту, просто жмем Enter.
root@sbc2 vmware-tools-distrib 
# ./vmware-install.pl 
Creating a new VMware Tools installer database using the tar4 format.

Installing VMware Tools.

In which directory do you want to install the binary files? 
[/usr/bin] 

What is the directory that contains the init directories (rc0.d/ to rc6.d/)? 
[/etc/rc.d] 

What is the directory that contains the init scripts? 
[/etc/rc.d/init.d] 

In which directory do you want to install the daemon files? 
[/usr/sbin] 

In which directory do you want to install the library files? 
[/usr/lib/vmware-tools] 

The path "/usr/lib/vmware-tools" does not exist currently. This program is 
going to create it, including needed parent directories. Is this what you want?
[yes] 

In which directory do you want to install the documentation files? 
[/usr/share/doc/vmware-tools] 

The path "/usr/share/doc/vmware-tools" does not exist currently. This program 
is going to create it, including needed parent directories. Is this what you 
want? [yes] 

The installation of VMware Tools 9.4.10 build-2068191 for Linux completed 
successfully. You can decide to remove this software from your system at any 
time by invoking the following command: "/usr/bin/vmware-uninstall-tools.pl".

Before running VMware Tools for the first time, you need to configure it by 
invoking the following command: "/usr/bin/vmware-config-tools.pl". Do you want 
this program to invoke the command for you now? [yes] 

Initializing...

Making sure services for VMware Tools are stopped.

Found a compatible pre-built module for vmci.  Installing it...


Found a compatible pre-built module for vsock.  Installing it...

The module vmxnet3 has already been installed on this system by another 
installer or package and will not be modified by this installer.

Use the flag --clobber-kernel-modules=vmxnet3 to override.

The module pvscsi has already been installed on this system by another 
installer or package and will not be modified by this installer.

Use the flag --clobber-kernel-modules=pvscsi to override.

The module vmmemctl has already been installed on this system by another 
installer or package and will not be modified by this installer.

Use the flag --clobber-kernel-modules=vmmemctl to override.

The VMware Host-Guest Filesystem allows for shared folders between the host OS 
and the guest OS in a Fusion or Workstation virtual environment.  Do you wish 
to enable this feature? [no] 

Found a compatible pre-built module for vmxnet.  Installing it...

The vmblock enables dragging or copying files between host and guest in a 
Fusion or Workstation virtual environment.  Do you wish to enable this feature?
[no] 

VMware automatic kernel modules enables automatic building and installation of
VMware kernel modules at boot that are not already present. This feature can be

enabled/disabled by re-running vmware-config-tools.pl.

Would you like to enable VMware automatic kernel modules?
[no] 

No X install found.

Creating a new initrd boot image for the kernel.

vmware-tools start/running
The configuration of VMware Tools 9.4.10 build-2068191 for Linux for this 
running kernel completed successfully.

You must restart your X session before any mouse or graphics changes take 
effect.

You can now run VMware Tools by invoking "/usr/bin/vmware-toolbox-cmd" from the
command line.

To enable advanced X features (e.g., guest resolution fit, drag and drop, and 
file and text copy/paste), you will need to do one (or more) of the following:
1. Manually start /usr/bin/vmware-user
2. Log out and log back into your desktop session; and,
3. Restart your X session.

Enjoy,

--the VMware team



20150902

Быстрые заметки по APC

2. Переключить web интерфейс обратно на http.
apc>web -S http
E002: Success
Reboot required for change to take effect.

apc>reboot
E000: Success
Reboot Management Interface
Enter 'YES' to continue or <ENTER> to cancel : yes

Rebooting...


1. Перезагрузка карты управления.
Из CLI
apc>reboot
E000: Success
Reboot Management Interface
Enter 'YES' to continue or <ENTER> to cancel : yes
Rebooting...

Сам ИБП продолжит работать. 


20150830

Насильно применить конфигурацию на развалившемся кластере состоящим из двух Juniper SRX.

Предположим что есть кластер на нодах которого, в результате неудачного обновления, стоят разные версии Junos (ну и там еще data-link порвали).

{primary:node0}[edit]
root@srx-n0#  run show system software
node0:
--------------------------------------------------------------------------
Information for junos:

Comment:
JUNOS Software Release [12.1X46-D35.1]

node1:
--------------------------------------------------------------------------
Information for junos:

Comment:
JUNOS Software Release [12.1X47-D25.4]

Обе RG работают на node0.
{primary:node0}[edit]
root@srx-n0# run show chassis cluster status
Monitor Failure codes:
    CS  Cold Sync monitoring        FL  Fabric Connection monitoring
    GR  GRES monitoring             HW  Hardware monitoring
    IF  Interface monitoring        IP  IP monitoring
    LB  Loopback monitoring         MB  Mbuf monitoring
    NH  Nexthop monitoring          NP  NPC monitoring            
    SP  SPU monitoring              SM  Schedule monitoring

Cluster ID: 3
Node   Priority Status         Preempt Manual   Monitor-failures

Redundancy group: 0 , Failover count: 1
node0  100      primary        no      no       None          
node1  1        secondary      no      no       None          

Redundancy group: 1 , Failover count: 1
node0  0        primary        no      no       IF CS        
node1  0        secondary      no      no       IF CS

Применить какие-либо изменения в конфигурации нельзя - srx ругается:

{primary:node0}[edit]
root@srx-n0# commit check
node0:
configuration check succeeds
error: error communicating with
error: remote commit-configuration failed on node1
error: configuration check-out failed
error:
Connection to node1 has been broken
error: remote unlock-configuration failed on node1

и 

{primary:node0}[edit]
root@srx-n0# commit 
node0: 

configuration check succeeds
error: 
Connection to node1 has been broken
warning: pull configuration failed, fallback to push configuration method
error: remote load-configuration failed on node1
error: remote unlock-configuration failed on node1

Поиск по подобным ошибкам выводит на команду "commit synchronize force".
В моем случае она не сработала.

{primary:node0}[edit]
root@srx-n0# commit synchronize force
node0:
configuration check succeeds
error:
Connection to node1 has been broken
warning: pull configuration failed, fallback to push configuration method
error: remote load-configuration failed on node1
error: remote unlock-configuration failed on node1


Для меня решением была скрытая команда "commit force", конфигурация применилась только на одной ноде.
{primary:node0}[edit]
root@msk-02-srx3-n0# commit fo                
                              ^
syntax error.
root@msk-02-srx3-n0# commit force          
node0:

commit complete

Вот.

20150827

Процесс установки сигнатур application-identification на кластер из srx.

В отличии от лицензий все действия с сигнатурами можно делать только на основной ноде.

Скачиваем сигнатуры.
{primary:node0}
root@srx-n0> request services application-identification download
Please use command
        "request services application-identification download status" to check download status

{primary:node0}
root@srx-n0> request services application-identification download status  
Fetching/Uncompressing https://signatures.juniper.net/xmlupdate/226/Libqmprotocols/2528/libqmprotocols.tgz

{primary:node0}
root@srx-n0> request services application-identification download status    
Downloading application package 2528 succeed.


Инсталируем сигнатуры.
{primary:node0}
root@srx-n0> request services application-identification install 
node0:
--------------------------------------------------------------------------
Please use command
        "request services application-identification install status" to check install status

node1:
--------------------------------------------------------------------------
Please use command
        "request services application-identification install status" to check install status


Следим за процессом. 
{primary:node0}
root@srx-n0> request services application-identification install status 
node0:
--------------------------------------------------------------------------
Checking compatibility of application package version 2528 ...

node1:
--------------------------------------------------------------------------
Checking compatibility of application package version 2528 ...


{primary:node0}
root@srx-n0> request services application-identification install status    
node0:
--------------------------------------------------------------------------
Installed Application package (2528) successfully in RE,
Application package and Protocol bundle installation in pfe is in progress

node1:
--------------------------------------------------------------------------
Cleaning up legacy configurations in Junos configuration ...


{primary:node0}
root@srx-n0> request services application-identification install status    
node0:
--------------------------------------------------------------------------
Installed Application package (2528) successfully in RE,
Application package and Protocol bundle installation in pfe is in progress

node1:
--------------------------------------------------------------------------
Installed Application package (2528) successfully in RE,
Application package and Protocol bundle installation in pfe is in progress



{primary:node0}
root@srx-n0> request services application-identification install status    
node0:
--------------------------------------------------------------------------
Installed
        Application package (2528) and Protocol bundle successfully

node1:
--------------------------------------------------------------------------
Installed Application package (2528) successfully in RE,
Application package and Protocol bundle installation in pfe is in progress


{primary:node0}
root@srx-n0> request services application-identification install status    
node0:
--------------------------------------------------------------------------
Installed
        Application package (2528) and Protocol bundle successfully

node1:
--------------------------------------------------------------------------
Installed
        Application package (2528) and Protocol bundle successfully


Проверяем версии.
{primary:node0}
root@srx-n0> show services application-identification version 
node0:
--------------------------------------------------------------------------

  Application package version: 2528

node1:
--------------------------------------------------------------------------

  Application package version: 2528

Смотрим на группы сигнатур.
{primary:node0}
root@srx-n0> show services application-identification group summary 
node0:
--------------------------------------------------------------------------
Application Group(s): 90
Application Groups                                Disabled  ID 
  junos:behavioral                                 No        92       
  junos:unassigned                                 No        91       
  junos:web:proxy                                  No        48       
  junos:remote-access:interactive-desktop          No        34       
  junos:infrastructure:mobile                      No        57       
  junos:web:wiki                                   No        54       
...


node1:
--------------------------------------------------------------------------
Application Group(s): 90
Application Groups                                Disabled  ID 
  junos:behavioral                                 No        92       
  junos:unassigned                                 No        91       
  junos:web:proxy                                  No        48       
  junos:remote-access:interactive-desktop          No        34       
  junos:infrastructure:mobile                      No        57       
  junos:web:wiki                                   No        54       
...

Ставим триальную лицензию на кластер из srx.

Лицензии надо ставить на каждой ноде отдельно.

Сначала будем ставить лицензии на node0 которая является главной нодой для RG0 (там, где RE крутится).
root@srx-n0> show chassis cluster status
Monitor Failure codes:
    CS  Cold Sync monitoring        FL  Fabric Connection monitoring
    GR  GRES monitoring             HW  Hardware monitoring
    IF  Interface monitoring        IP  IP monitoring
    LB  Loopback monitoring         MB  Mbuf monitoring
    NH  Nexthop monitoring          NP  NPC monitoring            
    SP  SPU monitoring              SM  Schedule monitoring
    CF  Config Sync monitoring

Cluster ID: 3
Node   Priority Status         Preempt Manual   Monitor-failures

Redundancy group: 0 , Failover count: 3
node0  100      primary        no      no       None          
node1  1        secondary      no      no       None          

Redundancy group: 1 , Failover count: 1
node0  100      primary        no      no       None          
node1  0        secondary      no      no       IF            

Запрашиваем лицензии.
{primary:node0}
root@srx-n0> request system license update trial

Trying to update trial license keys from https://ae1.juniper.net, use 'show system license' to check status.

Смотрим лицензии. 
{primary:node0}
root@srx-n0> show system license    
License usage: 
                                 Licenses     Licenses    Licenses    Expiry
  Feature name                       used    installed      needed 
  av_key_kaspersky_engine               0            1           0    2015-09-26 03:00:00 GMT-3
  anti_spam_key_sbl                     0            1           0    2015-09-26 03:00:00 GMT-3
  wf_key_surfcontrol_cpa                0            1           0    2015-09-26 03:00:00 GMT-3
  idp-sig                               0            1           0    2015-09-26 03:00:00 GMT-3
  dynamic-vpn                           0            2           0    permanent
  ax411-wlan-ap                         0            2           0    permanent
  appid-sig                             0            1           0    2015-09-26 03:00:00 GMT-3
  av_key_sophos_engine                  0            1           0    2015-09-26 03:00:00 GMT-3
  wf_key_websense_ewf                   0            1           0    2015-09-26 03:00:00 GMT-3

Licenses installed: 
....

Все хорошо. 

Руками переключаемся на node1. 
{primary:node0}
root@srx-n0> request chassis cluster failover redundancy-group 0 node 1 
node1:
--------------------------------------------------------------------------
Initiated manual failover for redundancy group 0

Переключилось.
root@srx-n1> show chassis cluster status      
Monitor Failure codes:
    CS  Cold Sync monitoring        FL  Fabric Connection monitoring
    GR  GRES monitoring             HW  Hardware monitoring
    IF  Interface monitoring        IP  IP monitoring
    LB  Loopback monitoring         MB  Mbuf monitoring
    NH  Nexthop monitoring          NP  NPC monitoring              
    SP  SPU monitoring              SM  Schedule monitoring
    CF  Config Sync monitoring
 
Cluster ID: 3
Node   Priority Status         Preempt Manual   Monitor-failures

Redundancy group: 0 , Failover count: 1
node0  100      secondary      no      yes      None           
node1  255      primary        no      yes      None           

Redundancy group: 1 , Failover count: 0
node0  100      primary        no      no       None           
node1  0        secondary      no      no       IF     

Запрашивем лицензии на node1.
{primary:node1}
root@srx-n1> request system license update trial 
Trying to update trial license keys from https://ae1.juniper.net, use 'show system license' to check status.
       
Все загрузилось.  
{primary:node1}
root@msk-02-srx3-n1> show system license                    
License usage: 
                                 Licenses     Licenses    Licenses    Expiry
  Feature name                       used    installed      needed 
  av_key_kaspersky_engine               0            1           0    2015-09-26 03:00:00 GMT-3
  anti_spam_key_sbl                     0            1           0    2015-09-26 03:00:00 GMT-3
  wf_key_surfcontrol_cpa                0            1           0    2015-09-26 03:00:00 GMT-3
  idp-sig                               0            1           0    2015-09-26 03:00:00 GMT-3
  dynamic-vpn                           0            2           0    permanent
  ax411-wlan-ap                         0            2           0    permanent
  appid-sig                             0            1           0    2015-09-26 03:00:00 GMT-3
  av_key_sophos_engine                  0            1           0    2015-09-26 03:00:00 GMT-3
  wf_key_websense_ewf                   0            1           0    2015-09-26 03:00:00 GMT-3

Licenses installed: 
...

Все.