Показаны сообщения с ярлыком linux. Показать все сообщения
Показаны сообщения с ярлыком linux. Показать все сообщения

вторник, 7 декабря 2021 г.

Convert DOS line endings to Linux line endings in Vim

 :set ff=unix

move back with 

:set ff=dos

пятница, 17 сентября 2021 г.

Remote reboot with Magic Sys Rq

Остановить останавливаемое, далее от root

# echo s > /proc/sysrq-trigger

# echo u > /proc/sysrq-trigger

# echo s > /proc/sysrq-trigger

# echo b > /proc/sysrq-trigger


где

s - sync

u - mount ro

b - immediate boot

(o - poweroff)


Magic SysRq key

четверг, 21 марта 2019 г.

Online PV migrate (linux)


1.  rescan-scsi-bus.sh -l -w -c -r --color
2.  multipath -ll

360060160ec111f009427dc9efd49e911 dm-4 DGC     ,RAID 5
size=11T features='1 queue_if_no_path' hwhandler='1 emc' wp=rw 
|-+- policy='service-time 0' prio=4 status=active                                                                                                                                             
| |- 3:0:1:1 sdn 8:208 active ready running                                                                                                                                                   
| `- 4:0:1:1 sdp 8:240 active ready running                                                                                                                                                   
`-+- policy='service-time 0' prio=1 status=enabled                                                                                                                                            
  |- 3:0:2:1 sdo 8:224 active ready running                                                                                                                                                   
  `- 4:0:2:1 sdq 65:0  active ready running                                                                                                                                                   
36006016050221e005e32f3dca0e7e711 dm-1 DGC     ,RAID 5
size=5.4T features='1 queue_if_no_path' hwhandler='1 emc' wp=rw                                                    
|-+- policy='service-time 0' prio=4 status=active
| |- 3:0:3:1 sdg 8:96  active ready running
| `- 4:0:3:1 sdm 8:192 active ready running
`-+- policy='service-time 0' prio=1 status=enabled
  |- 3:0:0:1 sdc 8:32  active ready running
  `- 4:0:0:1 sdi 8:128 active ready running



3.  pvcreate /dev/mapper/360060160ec111f009427dc9efd49e911
4.  vgextend CX3_40A /dev/mapper/360060160ec111f009427dc9efd49e911
5.  pvmove -b /dev/mapper/36006016050221e00d42fe01ba7b5e711 /dev/mapper/360060160ec111f009427dc9efd49e911

6. мониторить миграцию командой:  lvs -a -o+devices
  LV        VG      Attr      LSize  Pool Origin Data%  Move                                          Log Copy%  Convert Devices                                                                                          
  nbu_vol1  CX3_40A -wI-ao--- 14.29t                                                                                     /dev/mapper/360060160ec111f00e8a503161c47e911(0)                                                 
  nbu_vol1  CX3_40A -wI-ao--- 14.29t                                                                                     pvmove0(0)                                                                                       
  [pvmove0] CX3_40A p-C-aom--  5.37t                    /dev/mapper/360060160ec111f00e8a503161c47e911      76.25         /dev/mapper/36006016050221e005e32f3dca0e7e711(0),/dev/mapper/360060160ec111f009427dc9efd49e911(0)


7. vgreduce CX3_40A /dev/mapper/36006016050221e00d42fe01ba7b5e711
8. pvremove /dev/mapper/36006016050221e005e32f3dca0e7e711


PS
move LV to another PV

1.  lvresize -size 50G --resizefs /dev/mapper/CX3_40A-U0LV

2.  pvmove -n /dev/mapper/CX3_40A-U0LV /dev/mapper/36006016050221e01d42fe01ba7b5e711 /dev/mapper/360060160ec111e009427dc9efd49e911

вторник, 9 октября 2018 г.

mount vdi on debian streth



1. rmmod nbd
2. modprobe nbd max_part=16
3. qemu-nbd -c /dev/nbd0 /media/home/xp.vdi
4. ls -la /dev | grep nbd0
brw-rw----   1 root disk       43,   0 Oct  9 15:50 nbd0
brw-rw----   1 root disk       43,   1 Oct  9 15:50 nbd0p1
5. mount /dev/nbd0p1 /mnt
6. PROFIT
7. umount /mnt
8. qemu-nbd -d /dev/nbd0


PS
4.5  partx -a  /dev/nbd0

понедельник, 19 февраля 2018 г.

diff binary files


bsdiff/bspatch  AKA "Cannot allocate memory. Killed."

bsdiff is quite memory-hungry. It requires max(17*n,9*n+m)+O(1) bytes of memory, where n is the size of the old file and m is the size of the new file. bspatch requires n+m+O(1) bytes.

bsdiff runs in O((n+m) log n) time; on a 200MHz Pentium Pro, building a binary patch for a 4MB file takes about 90 seconds. bspatch runs in O(n+m) time; on the same machine, applying that patch takes about two seconds.

xdelta3

EXAMPLES
       Compress the differences between SOURCE and TARGET, yielding OUT, using
       "djw" secondary compression:
       xdelta3 -S djw -s SOURCE TARGET OUT

       Do the same, using standard input and output:
       xdelta3 -S djw -s SOURCE < TARGET > OUT

       To decompress OUT, using SOURCE, yielding TARGET:
       xdelta3 -d -s SOURCE OUT TARGET

четверг, 1 февраля 2018 г.

NAGIOS vs Windows perfomance counters

На виндовс клиенте установить NSClient++, в nsclient.ini добавить:
 
[/settings/NRPE/server]
; Undocumented key
allow arguments=1
allow nasty characters=true

[/settings/external scripts]
allow_nasty_meta_chars=1
allow nasty characters=true

В консоли nagios сервера, для проверки:

/usr/lib/nagios/plugins/check_nrpe -t 60 -H win0.domain.local -c  CheckCounter -a "Counter=\PhysicalDisk(_Total)\Disk Reads/sec"
OK: \PhysicalDisk(_Total)\Disk Reads/sec = 582|'\PhysicalDisk(_Total)\Disk Reads/secnone'=582;0;0

Список счетчиков смотреть в perfmon.exe Graph -> Properties->Data

В конфигурации nagios:

/etc/nagios-plugins/config/check_nrpe.cfg

#### windows
#perfomance checks
define command {
        command_name    check_win_perf
        command_line    /usr/lib/nagios/plugins/check_nrpe -t 60 -H $HOSTADDRESS$ -c CheckCounter -a "$ARG1$"
}

-----------------------
/etc/nagios3/conf.d/servers/windows/win0.domain.local.conf

define service{
        use                             stats-service
        host_name                 win0.domain.local
        service_description   Total Disk Reads:
        check_command       check_win_perf!Counter=\\PhysicalDisk\(_Total\)\\Disk\ Reads\/sec
        contact_groups          net_admins, nw_admins
        icon_image                arkoon/arkoon-service-harddisk.png
        }

пятница, 24 марта 2017 г.

HMC in vmware/virtualbox


подкат номер раз:
$ VBoxManage setextradata "vmname" "VBoxInternal/Devices/pcbios/0/Config/DmiSystemVendor" "IBM CORPORATION"
$ VBoxManage setextradata "vmname" "VBoxInternal/Devices/pcbios/0/Config/DmiSystemProduct" "7042CR5"
$ VBoxManage setextradata "vmname" "VBoxInternal/Devices/pcbios/0/Config/DmiSystemSerial" "06AAAAB"

https://sites.google.com/site/rhdisk0/unix/aix/hmc-in-virtualbox#TOC-Requisites


подкат номер два:
/mnt/initrd/opt/hmc/bin/GetVPD
    replace /usr/sbin/dmidecode --string bios-version | sed -e 's/-\[//g' | sed -e 's/\]-//g' line with echo "2AKT51A"
    replace sn=`/usr/sbin/dmidecode --string system-serial-number` with sn="7042CR7*10-1234A"
    replace echo "$cmodel$mtype" with echo "7042CR7"

/opt/hsc/bin/getHMCVPD
replace /usr/sbin/dmidecode --string bios-version | sed -e 's/-\[//g' | sed -e 's/\]-//g' with echo "2AKT51A"
replace echo "$cmodel$mtype*$sn" with echo "7042CR7*10-1234A"

replace echo "$cmodel$mtype" with echo "7042CR7"
http://emmanuel.iffly.free.fr/doku.php?id=aix:hmc_virtual

linux:: what proc using swap


список использующих своп
for file in /proc/*/status ; do awk '/VmSwap|Name/{printf $2 " " $3}END{ print ""}' $file; done

тоже самое отсортированное
for file in /proc/*/status ; do awk '/VmSwap|Name/{printf $2 " " $3}END{ print ""}' $file; done | sort -k 2 -n -r | less

вторник, 20 декабря 2016 г.

башизмы

for 1 to 28
for i in $(seq 1 28) ; do echo $i ; done 

cut video fragment
ffmpeg -i input.mp4 -acodec copy -vcodec copy -ss 00:17:00 -t 00:02:00 output.mp4

double video speed

mencoder -speed 2 -o output.avi -ovc lavc -nosound input.mp4

вторник, 21 июня 2016 г.

линуксовое сообщество всегда на высоте.


Dear Maintainer,

i know, that you compiled without -enable-command-args and you wrote in the NEWS.Debian file, that you disabled it because there are security problems and that this feature is often used wrong.
Some people need this feature to manage monitoring parameters central. Your nrpe.cfg disables this feature by default (don't_blame_nrpe=0) and the features comment shows everyone, that enable it could be a security Problem.

For my opinion, disable this feature by default should be enough. If someone need this feature, he must compile his own nrpe server version. Maybe he need to do it on hundreds of Machines and he has to do it again, if the Debian Packet is updated. I don't think that Compile nrpe without this feature is a real security advantage because if someone need it, he will compile with this support except of only enable this feature.

I Agree with you, that this option could be a security risk, but it is possible to reduce the risk by setting allowed_hosts to restric who is able to communicate with nrpe.

It would be nice if you would compile with -enable-command-args again. It would give more flexibility how to use nrpe and all people who use command args wouldn't need to manage their own version of this packet.



https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=756479

пятница, 5 февраля 2016 г.

вторник, 10 ноября 2015 г.

У линукс своя атмосфера.

у линукс своя атмосфера :-/

nagios@fs:~$ sensors
coretemp-isa-0000
Adapter: ISA adapter
Core 0: +36.0°C (high = +80.0°C, crit = +100.0°C)
Core 1: +39.0°C (high = +80.0°C, crit = +100.0°C)

coretemp-isa-0003
Adapter: ISA adapter
Core 0: +35.0°C (high = +86.0°C, crit = +100.0°C)
Core 1: +34.0°C (high = +86.0°C, crit = +100.0°C)


плагин nagios парсит построчно и обстановку видит как:

nagios@fs:~$ /usr/lib/nagios/plugins/check_lm_sensors --list
found sensor Core 0 (36.0)
found sensor Core 1 (39.0)
found sensor Core 0 (35.0)
found sensor Core 1 (34.0)

 

а мониторит так:
nagios@fs:~$ /usr/lib/nagios/plugins/check_lm_sensors --high Core_0=50,60
LM_SENSORS OK - Core 0=36.0|Core 0=36.0;50;60;;

 


ну вы поняли =) 

Как исправить:

nagios@fs:~$ cat /etc/sensors.d/coretemp.cfg
chip "coretemp-isa-0000"
 label temp2 "P0_Core0"
 label temp3 "P0_Core1"

chip "coretemp-isa-0003"
 label temp2 "P1_Core0"
 label temp3 "P1_Core1"
 

БЛЖАД! почему, почему у нулевого кора параметр temp2???

итого:
nagios@fs:~$ sensors
coretemp-isa-0000
Adapter: ISA adapter
P0_Core0:     +36.0°C  (high = +80.0°C, crit = +100.0°C)
P0_Core1:     +39.0°C  (high = +80.0°C, crit = +100.0°C)

coretemp-isa-0003
Adapter: ISA adapter
P1_Core0:     +35.0°C  (high = +86.0°C, crit = +100.0°C)
P1_Core1:     +34.0°C  (high = +86.0°C, crit = +100.0°C)

 

nagios@fs:~$ /usr/lib/nagios/plugins/check_lm_sensors --list
found sensor P0_Core0 (36.0)
found sensor P0_Core1 (39.0)
found sensor P1_Core0 (36.0)
found sensor P1_Core1 (35.0)

 

пятница, 25 сентября 2015 г.

microsoft такой microsoft

Host Limitations

Windows NTP server

The Linux NTP client used by Storwize V7000 may not always function correctly with Windows W32Time NTP Server


http://www-01.ibm.com/support/docview.wss?uid=ssg1S1004511

пятница, 4 сентября 2015 г.

nagios nrpe server

nrpe сервер с uptime-ом больше года штатно не завершается, конфиг не перечитывает.(отсыхает обработка сигналов?)
Сшибает глухого тока kill -9, примерно на 30% хостов.

четверг, 16 июля 2015 г.

Аналог FreeNas


Аналог FreeNAS на базе debian, без мутаций в enterprise класс.

http://www.openmediavault.org/features.html

четверг, 9 июля 2015 г.

Linux: Uhhuh. NMI received for unknown reason 21 on CPU 0.

Uhhuh. NMI received for unknown reason 21 on CPU 0.
Do you have a strange power saving mode enabled?
Dazed and confused, but trying to continue
Timeout, server bender not responding.


добавить в  grub.cfg
nohpet nmi_watchdog=0


в /etc/sysctl.conf
kernel.nmi_watchdog = 0

вторник, 9 июня 2015 г.

mkfs is apparently in use by the system will not make a filesystem here

mkfs is apparently in use by the system will not make a filesystem here

backup2:/mnt/ds6 # cat /etc/SuSE-release
SUSE Linux Enterprise Server 10 (x86_64)
VERSION = 10
PATCHLEVEL = 3

Залочку навешал multipathd, вырубить эту херню
  1. Use the multipath -f command to disable multipathing to a specific device. # multipath -f dm-1
  2. Use the multipath -F command to disable multipathing on all multipathed devices.# multipath -F

    Включить обратно: # multipathd -v0

таблица изменения времени в России с июля 1917 года

понедельник, 1 июня 2015 г.

тулзы для P-linux


Service and productivity tools
For Managed RHEL7 POWER Linux servers
https://www-304.ibm.com/webapp/set2/sas/f/lopdiags/redhat/hmcmanaged/rhel7.html

SDK for Linux on Power
https://www-304.ibm.com/webapp/set2/sas/f/lopdiags/sdkdownload.html

Latest Java Platform Standard Edition releases and download links
http://www.ibm.com/developerworks/java/jdk/linux/download.html