Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/virsh net list transform #6

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ LIBVIRT_URI|qemu:///system

## Zabbix

Add zabbix user in libvirt group (mandatory for running virsh command without sudo).

#~ git clone https://github.com/sergiotocalini/virbix.git
#~ sudo ./virbix/deploy_zabbix.sh "<LIBVIRT_URI>"
#~ sudo systemctl restart zabbix-agent
Expand Down
1 change: 1 addition & 0 deletions deploy_zabbix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ cp -r ${SOURCE_DIR}/virbix/scripts ${ZABBIX_DIR}/scripts/agentd/virbix/
cp ${SOURCE_DIR}/virbix/virbix.conf.example ${ZABBIX_DIR}/scripts/agentd/virbix/virbix.conf
cp ${SOURCE_DIR}/virbix/virbix.sh ${ZABBIX_DIR}/scripts/agentd/virbix/
cp ${SOURCE_DIR}/virbix/zabbix_agentd.conf ${ZABBIX_DIR}/zabbix_agentd.d/virbix.conf
chown -R zabbix:zabbix ${ZABBIX_DIR}/scripts/agentd/virbix
sed -i "s|LIBVIRT_DEFAULT_URI=.*|LIBVIRT_DEFAULT_URI=\"${LIBVIRT_URI}\"|g" ${ZABBIX_DIR}/scripts/agentd/virbix/virbix.conf
2 changes: 1 addition & 1 deletion virbix/scripts/domain_check.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env ksh

VIRSH="sudo `which virsh`"
VIRSH="`which virsh`"
UUID="${1}"
ATTR="${2}"

Expand Down
2 changes: 1 addition & 1 deletion virbix/scripts/domain_list.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env ksh

VIRSH="sudo `which virsh`"
VIRSH="`which virsh`"
for vm in `${VIRSH} list --all --uuid | sort | uniq`; do
output=""
${VIRSH} dominfo ${vm} | while read line; do
Expand Down
2 changes: 1 addition & 1 deletion virbix/scripts/net_check.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env ksh

APP_DIR=$(dirname $0)
VIRSH="sudo `which virsh`"
VIRSH="`which virsh`"
UUID="${1}"
ATTR="${2}"
TIMESTAMP=`date '+%s'`
Expand Down
4 changes: 2 additions & 2 deletions virbix/scripts/net_list.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env ksh

VIRSH="sudo `which virsh`"
for net in `${VIRSH} net-list --all --uuid | sort | uniq`; do
VIRSH="`which virsh`"
for net in `${VIRSH} net-list --all | sed 1,2d | sed '/^$/d' | cut -d' ' -f 2 | uniq`; do
output=""
${VIRSH} net-info ${net} | while read line; do
key=`echo ${line}|awk -F: '{print $1}'|awk '{$1=$1};1'`
Expand Down
2 changes: 1 addition & 1 deletion virbix/scripts/pool_check.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env ksh

APP_DIR=$(dirname $0)
VIRSH="sudo `which virsh`"
VIRSH="`which virsh`"
UUID="${1}"
ATTR="${2}"
TIMESTAMP=`date '+%s'`
Expand Down
2 changes: 1 addition & 1 deletion virbix/scripts/pool_list.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env ksh

VIRSH="sudo `which virsh`"
VIRSH="`which virsh`"
for vm in `${VIRSH} pool-list --all | egrep -v "(^-.*|^ Name.*|^$)" | awk '{print $1}' | sort | uniq`; do
output=""
${VIRSH} pool-info ${vm} | while read line; do
Expand Down
2 changes: 1 addition & 1 deletion virbix/scripts/report_domains.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ TIMESTAMP=`date '+%s'`

IFS_DEFAULT="${IFS}"

VIRSH="sudo `which virsh`"
VIRSH="`which virsh`"
UUID="${1:-all}"
TYPE="${2:-json}"

Expand Down
2 changes: 1 addition & 1 deletion virbix/scripts/report_nets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ TIMESTAMP=`date '+%s'`

IFS_DEFAULT="${IFS}"

VIRSH="sudo `which virsh`"
VIRSH="`which virsh`"
UUID="${1:-all}"
TYPE="${2:-json}"

Expand Down
2 changes: 1 addition & 1 deletion virbix/scripts/report_node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ TIMESTAMP=`date '+%s'`

IFS_DEFAULT="${IFS}"

VIRSH="sudo `which virsh`"
VIRSH="`which virsh`"
UUID="${1:-all}"
TYPE="${2:-json}"

Expand Down
2 changes: 1 addition & 1 deletion virbix/scripts/report_pools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ TIMESTAMP=`date '+%s'`

IFS_DEFAULT="${IFS}"

VIRSH="sudo `which virsh`"
VIRSH="`which virsh`"
UUID="${1:-all}"
TYPE="${2:-json}"

Expand Down