Skip to content

Instantly share code, notes, and snippets.

@webmaks
Last active January 2, 2016 20:58
Show Gist options
  • Save webmaks/8359940 to your computer and use it in GitHub Desktop.
Save webmaks/8359940 to your computer and use it in GitHub Desktop.
Zabbix
#!/bin/bash
# centos.sh
$HOSTNAME=`hostname`
$SERVER='mon.sys-tools.net'
# Add required repository
sudo rpm --import http://repo.zabbixzone.com/centos/RPM-GPG-KEY-zabbixzone
sudo rpm -Uvh http://repo.zabbixzone.com/centos/zabbixzone-release-0.0-1.noarch.rpm
# Install last avaliable version of zabbix-agent
sudo yum -y install zabbix-agent
# Add autoload
sudo chkconfig zabbix-agent on
# Create a backup configuration file of zabbix-agent
cp /etc/zabbix/zabbix_agentd.conf{,.orig}
# Remove all lines in configuration file of zabbix-agent, which contains Hostname or Server words
sed -i "/Hostname=/ s/^.*$//g" /etc/zabbix/zabbix_agentd.conf
sed -i "/Server=/ s/^.*$//g" /etc/zabbix/zabbix_agentd.conf
# Add directives Server and Hostname to configuration file of zabbix-agent
echo "Server=${SERVER}" >> /etc/zabbix/zabbix_agentd.conf
echo "Hostname=${HOSTNAME}" >> /etc/zabbix/zabbix_agentd.conf
# Restart service zabbix-agent
sudo /etc/init.d/zabbix-agent start
sudo /etc/init.d/zabbix-agent stop
#!/bin/bash
$HOSTNAME=`hostname`
$SERVER='mon.sys-tools.net'
# Get information about last versions of all packages in system
sudo apt-get update
# Install last avaliable version of zabbix-agent
sudo apt-get -y install zabbix-agent
# Create a backup configuration file of zabbix-agent
cp /etc/zabbix/zabbix_agentd.conf{,.orig}
# Remove all lines in configuration file of zabbix-agent, which contains Hostname or Server words
sed -i "/Hostname=/ s/^.*$//g" /etc/zabbix/zabbix_agentd.conf
sed -i "/Server=/ s/^.*$//g" /etc/zabbix/zabbix_agentd.conf
# Add directives Server and Hostname to configuration file of zabbix-agent
echo "Server=${SERVER}" >> /etc/zabbix/zabbix_agentd.conf
echo "Hostname=${HOSTNAME}" >> /etc/zabbix/zabbix_agentd.conf
# Restart service zabbix-agent
sudo service zabbix-agent restart
#!/bin/bash
# fedora.sh
$HOSTNAME=`hostname`
$SERVER='mon.sys-tools.net'
# Add required repository
sudo rpm --import http://repo.zabbixzone.com/centos/RPM-GPG-KEY-zabbixzone
sudo rpm -Uvh http://repo.zabbixzone.com/centos/zabbixzone-release-0.0-1.noarch.rpm
# Install last avaliable version of zabbix-agent
sudo yum -y install zabbix-agent
# Add autoload
sudo chkconfig zabbix-agent on
# Create a backup configuration file of zabbix-agent
cp /etc/zabbix/zabbix_agentd.conf{,.orig}
# Remove all lines in configuration file of zabbix-agent, which contains Hostname or Server words
sed -i "/Hostname=/ s/^.*$//g" /etc/zabbix/zabbix_agentd.conf
sed -i "/Server=/ s/^.*$//g" /etc/zabbix/zabbix_agentd.conf
# Add directives Server and Hostname to configuration file of zabbix-agent
echo "Server=${SERVER}" >> /etc/zabbix/zabbix_agentd.conf
echo "Hostname=${HOSTNAME}" >> /etc/zabbix/zabbix_agentd.conf
# Restart service zabbix-agent
sudo /etc/init.d/zabbix-agent start
sudo /etc/init.d/zabbix-agent stop
#!/bin/bash
# mint.sh
$HOSTNAME=`hostname`
$SERVER='mon.sys-tools.net'
# Get information about last versions of all packages in system
sudo apt-get update
# Install last avaliable version of zabbix-agent
sudo apt-get -y install zabbix-agent
# Create a backup configuration file of zabbix-agent
cp /etc/zabbix/zabbix_agentd.conf{,.orig}
# Remove all lines in configuration file of zabbix-agent, which contains Hostname or Server words
sed -i "/Hostname=/ s/^.*$//g" /etc/zabbix/zabbix_agentd.conf
sed -i "/Server=/ s/^.*$//g" /etc/zabbix/zabbix_agentd.conf
# Add directives Server and Hostname to configuration file of zabbix-agent
echo "Server=${SERVER}" >> /etc/zabbix/zabbix_agentd.conf
echo "Hostname=${HOSTNAME}" >> /etc/zabbix/zabbix_agentd.conf
# Restart service zabbix-agent
sudo service zabbix-agent restart
#!/bin/bash
# suse.sh
$HOSTNAME=`hostname`
$SERVER='mon.sys-tools.net'
# Install last avaliable version of zabbix-agent
zypper install zabbix-agent
# Add tu autoload
sudo chkconfig zabbix-agentd on
# Create a backup configuration file of zabbix-agent
cp /etc/zabbix/zabbix_agentd.conf{,.orig}
# Remove all lines in configuration file of zabbix-agent, which contains Hostname or Server words
sed -i "/Hostname=/ s/^.*$//g" /etc/zabbix/zabbix_agentd.conf
sed -i "/Server=/ s/^.*$//g" /etc/zabbix/zabbix_agentd.conf
# Add directives Server and Hostname to configuration file of zabbix-agent
echo "Server=${SERVER}" >> /etc/zabbix/zabbix_agentd.conf
echo "Hostname=${HOSTNAME}" >> /etc/zabbix/zabbix_agentd.conf
# Restart service zabbix-agent
sudo service zabbix-agent restart
#!/bin/bash
# ubuntu.sh
$HOSTNAME=`hostname`
$SERVER='mon.sys-tools.net'
# Get information about last versions of all packages in system
sudo apt-get update
# Install last avaliable version of zabbix-agent
sudo apt-get -y install zabbix-agent
# Create a backup configuration file of zabbix-agent
cp /etc/zabbix/zabbix_agentd.conf{,.orig}
# Remove all lines in configuration file of zabbix-agent, which contains Hostname or Server words
sed -i "/Hostname=/ s/^.*$//g" /etc/zabbix/zabbix_agentd.conf
sed -i "/Server=/ s/^.*$//g" /etc/zabbix/zabbix_agentd.conf
# Add directives Server and Hostname to configuration file of zabbix-agent
echo "Server=${SERVER}" >> /etc/zabbix/zabbix_agentd.conf
echo "Hostname=${HOSTNAME}" >> /etc/zabbix/zabbix_agentd.conf
# Restart service zabbix-agent
sudo service zabbix-agent restart
#!/bin/bash
# ubuntu.sh
$HOSTNAME=`hostname`
$SERVER='mon.sys-tools.net'
# Get information about last versions of all packages in system
sudo apt-get update
# Install last avaliable version of zabbix-agent
sudo apt-get -y install zabbix-agent
# Create a backup configuration file of zabbix-agent
cp /etc/zabbix/zabbix_agentd.conf{,.orig}
# Remove all lines in configuration file of zabbix-agent, which contains Hostname or Server words
sed -i "/Hostname=/ s/^.*$//g" /etc/zabbix/zabbix_agentd.conf
sed -i "/Server=/ s/^.*$//g" /etc/zabbix/zabbix_agentd.conf
# Add directives Server and Hostname to configuration file of zabbix-agent
echo "Server=${SERVER}" >> /etc/zabbix/zabbix_agentd.conf
echo "Hostname=${HOSTNAME}" >> /etc/zabbix/zabbix_agentd.conf
# Restart service zabbix-agent
sudo service zabbix-agent restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment