Kerya techblog

Most Read Posts

  • Gentoo mail (postfix + postfixadmin + dovecot + amavisd-new + roundcube)
  • Zabbix - no such instance currently exists at this oid
  • LVM cant Boot - ALERT /dev/mapper/ubuntu--vg-root does not exist DROPPING to Shell -
  • liquidsoap-1.1.1 gentoo install
  • Laravel manual user register
  • Gentoo: php 5.6.0 + pecl-memcached 2.2.0 install script
  • Zabbix APC Smart UPS monitoring on FreeBSD with snmp
  • Squid 3.4 debian 7 install script
  • Подключение Foxgate S6224-S2 Ubuntu minicom
  • Abills
  • exim+dovecot+postfixadmin+clamav+spamassassin on FreeBSD
  • Openmeetings 2.1.1 Ubuntu 12.04.2 installation
  • libtool version mismatch pecl gentoo
  • Securing NTP
  • FreeBSD 9 ossec setup errors fix
  • fix for - corrupted record for package (pkgdep line without argument), ignoring
  • snmpd less verbose log FreeBSD (Connection from UDP messages)
  • Mikrotik no-ip ddns update script
  • Скопировать права mysql gentoo
  • mysql backup scripts
  1. Вы здесь:  
  2. Home
  • Home
  • Все статьи

Newrelic soap api request with synthetic

Подробности
Автор: Kirill
var assert = require('assert');

var url = "http://name.somehost.com:8080/test/xmls";
var soapMsg = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><WEBPartInquiryRequest><Envelope><BuyPartnerID>86</BuyPartnerID> <DocVersNum>1.0</DocVersNum><DocGenBy>WIT</DocGenBy></Envelope><RequestRouter><SellPartnerID>PAD08</SellPartnerID><CustNum>89</CustNum></RequestRouter><PartRequestAction><AskPayForm/><AskShipList/><ReturnAltLocInfo value=\"Always\"/><AskPriceTypes/></PartRequestAction><PartInquiryRequest><ItemDefaults><OrderType>Normal</OrderType><Vehicle><CatVehID/><Year>0</Year><Make/><Model/><Engine/><SpeclCond/></Vehicle></ItemDefaults><RequestItem><ID>1</ID><PartNum>1</PartNum><BuyerDesc/><MfgCode>AC</MfgCode><Qty>4</Qty></RequestItem></PartInquiryRequest></WEBPartInquiryRequest>";

var options = {
//Define endpoint URL.
url: url,
//Define body of POST request.
body: soapMsg,
//Define insert key and expected data type.
headers: {
// 'Content-Type': 'application/soap+xml;charset=UTF-8;action="http://www.webserviceX.NET/GetQuote"',
// 'Host': 'www.webservicex.net',
// 'Accept-Encoding': 'gzip,deflate',
// 'Connection': 'Keep-Alive'
'SOAPAction':'',
'charset':'utf-8',
'Content-Type':'text/xml',
'User-Agent':''
}
};

//Define expected results using callback function.
function callback(error, response, body) {
//Log status code to Synthetics console.
console.log(response.statusCode + " status code");
//Verify endpoint returns 200 (OK) response code.
assert.ok(response.statusCode == 200, 'Expected 200 OK response');
//Parse JSON received from Insights into variable.
//
var parseString = require('xml2js').parseString;
var XMLReSULT = response.body;
parseString(XMLReSULT, function (err, result) {
console.dir(result);
 
});
 
//Log end of script.
console.log("End reached");
}

//Make POST request, passing in options and callback.
$http.post(options, callback);
 

-----------------------

from

https://discuss.newrelic.com/t/creating-soap-request-using-the-api-scripting-language/28167

 

Newrelic monitoring sending post data

Подробности
Автор: Kirill

Goal : to make it work in newrelic

curl -X POST -F <data1> -F <data2> -F <data3> <URI>

Find substring 'Successful' on the result page

-------------------

API test should be created in newrelic. Code:

var assert = require('assert');

var options = {
url: 'http://some.example.com/app/somefile.php?param1=2&param2=1',
body: "field1=data1&field2=data2",
headers: {
'Content-Type': 'application/x-www-formurlencoded'
}
};

//Define expected results using callback function.
function callback(error, response, body) {
//Log status code to Synthetics console.
console.log(response.statusCode + " status code")
//Verify endpoint returns 200 (OK) response code.
var match_result = body.match(/Successful/);
 
assert.ok((response.statusCode == 200) && (match_result != null), 'Expected 200 OK response and "Successful" on the page');
 
//Log end of script.
console.log("End reached");
}

$http.post(options, callback);
 

borg backup FreeBSD

Подробности
Автор: Kirill

 

https://habr.com/ru/company/flant/blog/420055/

https://borgbackup.readthedocs.io/en/stable/installation.html

1. install borg on both backup server and client :

portsnap fetch update ; portmaster -Dbg archivers/py-borgbackup

2. Add user on server

# pw user add -n borg -m -s /sbin/nologin

3. on client generate ssh key :

#  ssh-keygen -b 4096

4. on server add key :

# cd /home/borg//.ssh

# echo 'command="/usr/local/bin/borg serve" ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDNdaDfqUUf/XmSVWfF7PfjGlbKW00MJ63zal/E/mxm+vJIJRBw7GZofe1PeTpKcEUTiBBEsW9XUmTctnWE6p21gU/JNU0jITLx+vg4IlVP62cac71tkx1VJFMYQN6EulT0alYxagNwEs7s5cBlykeKk/QmteOOclzx684t9d6BhMvFE9w9r+c76aVBIdbEyrkloiYd+vzt79nRkFE4CoxkpvptMgrAgbx563fRmNSPH8H5dEad44/Xb5uARiYhdlIl45QuNSpAdcOadp46ftDeQCGLc4CgjMxessam+9ujYcUCjhFDNOoEa4YxVhXF9Tcv8Ttxolece6y+IQM7fbDR' > authorized_keys

# chown -R borg:borg /home/borg/.ssh/

 5. on client init repo

#  borg init -e none ssh:Этот адрес электронной почты защищён от спам-ботов. У вас должен быть включен JavaScript для просмотра.:port/path/to/backups

 6. on client run first backup :

# borg create --stats --list ssh://borg@host:port/path/to/backup::"MyFirstBackup-{now:%Y-%m-%d_%H:%M:%S}" /etc /root /usr/local/etc

------------------
List backups

on client machine :

borg list ssh://borg@host:port/path/to/backups

on server :

borg list /path/to/backups

-----------------

 List files in backups :

borg list /path/to/backups::MyBackup-<date>

-------------

Extract file or directory from backup (on server) :

borg extract /path/to/backups::MyBackup-<date> etc/hostname

------------

 

mysql batch change charset for tables

Подробности
Автор: Kirill
  • mysql
  • zabbix

in this case for zabbix database:

Convert tables  from latin1 to utf-8 :

mysql zabbix -B -N -e 'show tables' | xargs -L 1 | awk '{print "ALTER TABLE "$1" CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin"}' | xargs -L 1 -I {} echo mysql zabbix -e \' {} \' | sh -x

 

convert database charset :

mysql -e 'ALTER DATABASE zabbix DEFAULT CHARACTER SET utf8 COLLATE utf8_bin'

  1. systemd-resolved vpn dns servers priority
  2. Mikrotik no-ip ddns update script

Страница 5 из 17

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

Search

Older Posts

  • Greenbone Vulnerability Manager (GVM) hacks (63)
  • elasticsearch cluster red status fix due to high watermark (61)
  • ubuntu arrow keys misbehaviour fix (72)
  • icinga IIS monitoring powershell error Get-WmiObject : Invalid namespace "root\WebAdministration" (84)
  • Make user superadmin in zabbix (81)
  • dnf Error: unknown option (111)
  • unpack pfx certificate (used for apache or nginx) (116)
  • mysql audit plugin build script (290)
  • mysql dump one row (95)
  • redmine 5 docker-compose (199)
  • gitlab runner dind docker-compose (143)
  • AWS S3 IAM policy to limit to single sub folder (146)
  • logrotate hints (197)
  • bash script to clean files to required percentage (322)
  • Ansible create LVM and mount (732)

Login Form

  • Забыли пароль?
  • Забыли логин?
  • Регистрация