zabbix_agentd config file with variable combination - zabbix

envrionment description:
zabbix_agentd -V
zabbix_agentd (daemon) (Zabbix) 6.0.8
Revision c7c3044a4a2 29 August 2022, compilation time: Aug 29 2022 07:33:19
problem description:
Is it possible to use variable in configuration file of zabbix agent like below
I expect(let's say system.hostname = question)
HostInterface=system.hostname.stackoverflow.com
to be
HostInterface=question.stackoverflow.com

Related

airflow command not found when installing in Ubuntu via WSL - how to add it to path?

I have Ubuntu 20.04 and python 3.10.6 on WSL.
I have been trying to install airflow, and am getting 'airflow: command not found' when I'm trying to do 'airflow initdb' or 'airflow info'.
I have done
export AIRFLOW_HOME=~/airflow
and when I run
myname#LAPTOP-28BMMQV7:/root$ ls -l ~/.local/bin
I can see airflow in the list of files.
drwxrwxr-x 2 myname myname 4096 Nov 20 14:17 __pycache__
-rwxrwxr-x 1 myname myname 3472 Nov 20 14:17 activate-global-python-argcomplete
-rwxrwxr-x 1 myname myname 215 Nov 20 14:17 airflow
-rwxrwxr-x 1 myname myname 213 Nov 20 14:17 alembic
when I run this command to see where my python is, I can see this
myname#LAPTOP-28BMMQV7:/root$ ls -l /usr/bin/python*
lrwxrwxrwx 1 root root 10 Aug 18 11:39 /usr/bin/python3 -> python3.10
lrwxrwxrwx 1 root root 17 Aug 18 11:39 /usr/bin/python3-config -> python3.10-config
-rwxr-xr-x 1 root root 5912936 Nov 2 18:53 /usr/bin/python3.10
I also warnings similar to this:
WARNING: The script pygmentize is installed in '/home/myname/.local/bin' which is not on PATH.
So I need to find a way to add this directory to PATH.
I have found the following advice from the airflow documentation,
If the airflow command is not getting recognized (can happen on Windows when using WSL), then ensure that ~/.local/bin is in your PATH environment variable, and add it in if necessary:
PATH=$PATH:~/.local/bin
am not quite sure how to do it?
I also have a MySQL workbench/server 8.0.31 installed and want to connect it to airflow instead of SQLite. can anybody refer me to a good guide on how to install it correctly?
I have run 'pip install 'apache-airflow[mysql]'.
You were so close! I think your local python (and your terminal whenever you tried airflow db init ) was not able to see the airflow you installed on its path.
There is this video series I go to, whenever I need to install Airflow for a fellow coworker.
This video shows how to install Airflow locally. Also, in the second video it shows how to write a DAG.
And more importantly, on the third video it shows how to connect to a different database just like you wanted.

How to fix the 'Can't load'-error when a perl script is executing 'use DBD::mysql;'

For years, I'm running a perl script on my Synology NAS. This script writes to a MariaDB database. I never had any errors. Until the migration to DSM7. This is what happened ...
I never had any problem when using MariaDB5
I migrated my database from MariaDB5 to MariaDB10. I changed the database name and the credentials to make sure my perl script used the MariaDB10 database. Everything worked fine!
I upgraded my Synology NAS to DSM7, following the provided procedure, including the requirement to remove the MariaDB5 package.
Afterwards, I noticed I following error:
Can't load '/usr/local/lib/perl5/vendor_perl/auto/DBD/mysql/mysql.so' for module DBD::mysql: libmariadb.so.3: cannot open shared object file: No such file or directory at /usr/local/lib/perl5/core_perl/DynaLoader.pm line 193.
at ./mysql1_MDB10.pl line 2.
Compilation failed in require at ./mysql1_MDB10.pl line 2.
BEGIN failed--compilation aborted at ./mysql1_MDB10.pl line 2.
To make it easy to debug, I created a test script:
#!/usr/bin/perl
use DBD::mysql;
$solDBIDB = 'DBI:mysql:database=SOLAR2_10;host=127.0.0.1;port=3307';
$DBUser = 'mydbuser';
$DBPass = 'mydbpass';
$dbh = DBI->connect($solDBIDB, $DBUser, $DBPass) || die "Could not connect to database: $DBI::errstr";
$query = "SELECT * FROM SOLAR2_10.SUM_DATA_ITEMS";
$query_handle = $dbh->prepare($query);
# EXECUTE THE QUERY
$query_handle->execute();
I'm using a Synology NAS DS415P with DSM DSM 7.1-42661 Update 2 (latest updates)
Perl is installed as a package (via the Synology Package center)
perl -v provides the following version information: This is perl 5, version 28, subversion 3 (v5.28.3) built for i686-linux
The version of MariaDB10 is 10.3.32-1040
Update after comment #ikegami
I'm able to find the mysql.so file:
-r-xr-xr-x 1 root root 131923 Apr 21 2021 /usr/local/lib/perl5/vendor_perl/auto/DBD/mysql/mysql.so
I'm able to find the various libmariadb.so files:
ls -l in /volume1/#appstore/MariaDB10/usr/local/mariadb10/lib
lrwxrwxrwx 1 root root 15 Nov 23 2021 libmariadb.so -> libmariadb.so.3
-rwxr-xr-x 1 root root 275356 Nov 23 2021 libmariadb.so.3
lrwxrwxrwx 1 root root 15 Nov 23 2021 libmysqlclient_r.so -> libmariadb.so.3
lrwxrwxrwx 1 root root 15 Nov 23 2021 libmysqlclient.so -> libmariadb.so.3
lrwxrwxrwx 1 root root 17 Nov 23 2021 libmysqld.so -> libmariadbd.so.19
drwxr-xr-x 3 root root 4096 Nov 23 2021 mysql
drwxr-xr-x 2 root root 4096 Nov 23 2021 pkgconfig
Additional info:
cpan -l | egrep -i "mysql"
Bundle::DBD::mysql 4.048
DBD::mysql 4.048
DBD::mysql::GetInfo undef
To me, everything looks properly installed ...
What am I missing?

QEMU+Virt-manager can't connect to virtlxcd-sock

I've installed qemu virt-manager libvirt on Linux Mint 20, I have a AMD FX(tm)-4300 Quad-Core Processor with AMD-V enabled in the bios, restarted a lot but virt-manager(Virtual Machine Manager) is saying:
Unable to connect to libvirt lxc:///.
Failed to connect socket to '/var/run/libvirt/virtlxcd-sock': No such file or directory
Libvirt URI is: lxc:///
I am running this locally. The file/socket does not exist, but there is a "libvirt-sock" (and other files) in that folder.
The service is running, but reporting the same error:
libvirtd.service - Virtualization daemon
Loaded: loaded (/lib/systemd/system/libvirtd.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2020-09-01 10:11:27 BST; 12min ago
TriggeredBy: ● libvirtd.socket
● libvirtd-ro.socket
● libvirtd-admin.socket
Docs: man:libvirtd(8)
https://libvirt.org
Main PID: 731 (libvirtd)
Tasks: 19 (limit: 32768)
Memory: 34.2M
CGroup: /system.slice/libvirtd.service
├─ 731 /usr/sbin/libvirtd
├─1041 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/lib/libvirt/libvirt>
└─1042 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/lib/libvirt/libvirt>
Sep 01 10:11:29 mainlinux dnsmasq[1041]: read /var/lib/libvirt/dnsmasq/default.addnhosts - 0 addresses
Sep 01 10:11:29 mainlinux dnsmasq-dhcp[1041]: read /var/lib/libvirt/dnsmasq/default.hostsfile
Sep 01 10:12:35 mainlinux libvirtd[731]: libvirt version: 6.0.0, package: 0ubuntu8.3 (Marc Deslauriers <marc.deslauriers#ubuntu.com> Thu, 30 >
Sep 01 10:12:35 mainlinux libvirtd[731]: hostname: mainlinux
Sep 01 10:12:35 mainlinux libvirtd[731]: Failed to connect socket to '/var/run/libvirt/virtlxcd-sock': No such file or directory
Sep 01 10:12:35 mainlinux libvirtd[731]: End of file while reading data: Input/output error
I'm updated my kernel to 5.8.5-generic, but other than that, running Mint 20 (based on Ubuntu focal). Anyone know how to fix this, or display a log as to why virtlxcd-sock is not being created?
Also tried sudo chmod 777 on the libvirt subfolder and restarted libvirtd, same error.
Been googling for hours, finally found the one that worked for me, seems like installing libvirt and lxc does not install this package:
sudo apt install libvirt-daemon-driver-lxc
sudo systemctl restart libvirtd

Upgrading to MySQL 5.7 on YUM

I would really appreciate help. I'm new to Linux and Yum. I recently purchased a VPS and it only has MySQL 5.6. I want to update to 5.7 and I'm stuck. pulling hair out over here. I've gotten to the point where i enter command createrepo but there doesn't seem to be any directory created by it as i read there should be. The server is running CentOS 6.9. Here are the steps i followed:
Downloaded Red Hat Enterprise Linux 6 / Oracle Linux 6 (Architecture Independent), RPM Package from https://dev.mysql.com/downloads/repo/yum/ .
Used FTP client to upload the file to my server in a directory called downloads.
in PuTTy went to the downloads folder and typed 'ls', i can see the file is there. it appears in red as "mysql57-community-release-el6-11.noarch.rpm"
typed createrepo /downloads while in the downloads directory and I get:
Spawning worker 0 with 1 pkgs Workers Finished Gathering worker
results
Saving Primary metadata Saving file lists metadata Saving other
metadata Generating sqlite DBs Sqlite DBs complete
ACCORDING to the documentation i read it's supposed to create another directory at this point but when i type ls there is still just the file there. when i run the command again as createrepo /downloads -v i get:
Spawning worker 0 with 1 pkgs
Worker 0: reading mysql57-community-release-el6-11.noarch.rpm
Workers Finished
Gathering worker results
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Starting other db creation: Wed Mar 21 06:30:38 2018
Ending other db creation: Wed Mar 21 06:30:38 2018
Starting filelists db creation: Wed Mar 21 06:30:38 2018
Ending filelists db creation: Wed Mar 21 06:30:38 2018
Starting primary db creation: Wed Mar 21 06:30:38 2018
Ending primary db creation: Wed Mar 21 06:30:38 2018
Sqlite DBs complete
I've also tried localinstall command on the file in the directory with "yum localinstall mysql57-community-release-el6-11.noarch.rpm and i get:
Loading "fastestmirror" plugin
Loading "security" plugin
Loading "universal-hooks" plugin
Config time: 0.033
Yum Version: 3.2.29
Setting up Local Package Process
rpmdb time: 0.000
Examining mysql57-community-release-el6-11.noarch.rpm: mysql57-community-release-el6-11.noarch
Excluding mysql57-community-release-el6-11.noarch
Nothing to do
I think the file may have been installed already kind of inadvertently as i have been struggling with this for hours but then when i call createrepo shouldn't it create the repository using the RPM file?
Thanks for any help!
It may be easier to delete the file you created and use the steps below (Taken from a production box)
The repo uses the name mysql-community-* That's why you couldn't find the package mysql-server via yum
Create a new file /etc/yum.repos.d/mysql-community.repo and add the following;
[mysql-connectors-community]
name=MySQL Connectors Community
baseurl=http://repo.mysql.com/yum/mysql-connectors-community/el/6/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
[mysql-tools-community]
name=MySQL Tools Community
baseurl=http://repo.mysql.com/yum/mysql-tools-community/el/6/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
[mysql57-community]
name=MySQL 5.7 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/6/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Then do;
yum clean all
yum upgrade mysql-community-server
Which should install & upgrade you to 5.7 - Remember to run mysql_upgrade after MySQL has restarted.

virsh attatch-disk failed: no such file or directory

I'm using virsh attatch-disk to add a new device to a running guest under KVM:
# virsh attatch-disk <running-guest-id> --source c.raw --target vdb
the output is:
error: Failed to attach disk
error: Failed to open file 'c.raw': No such file or directory
But the new disk file is under the pwd:
ls -l
total 26653060
-rw-r--r--. 1 root root 8312913920 Jan 10 10:25 c.q
-rw-r--r--. 1 root root 53687091200 Jan 5 16:50 c.raw
-rw-r--r--. 1 root root 10759023104 Jan 6 02:14 c.VHD
why virsh open failed? I browsed libvirtd.log:
2017-01-14 15:22:00.954+0000: 2204: error : virStorageFileGetMetadataRecurse:952 : Failed to open file 'c.raw': No such file or directory
2017-01-14 15:22:08.310+0000: 2209: info : remoteDispatchAuthList:2432 : Bypass polkit auth for privileged client pid:1921,uid:0
What the log mean?
virsh --version
0.10.2
qemu-x86_64 -version
qemu-x86_64 version 2.4.1, Copyright (c) 2003-2008 Fabrice Bellard
I got the answer, you must use c.raw's Abs path, relative path are not handled by virsh.