Archive

Archive for December, 2015

Installing Zabbix Version 2.4 Offline (Zabbix Server without Internet).

December 30, 2015 Leave a comment
There might be situations where you have a remote/zabbix server which does not have internet connectivity, due to security or other reasons.
So we create a custom repo on the remote/zabbix server so that we can install zabbix using rpms
Here is how we are planning to do this.
  1. Download all the dependency rpms on a machine which has internet connection, using yum-downloadonly or repotrack.
  2. Transfer all the rpms to the remote server.
  3. Create a repo on the remote server.
  4. Update yum configuration.
  5. Install.
NOTE: This method can be used to install any application, but here we have used zabbix as we had this requirement for a zabbix server.

Download dependent rpms.

On a machine which has internet connection install the package below. And download all the rpms.
Make sure the system are similar (not required to be identical – At-least the OS should be of same version)
mkdir /zabbix_rpms
yum install yum-downloadonly
Downloading all the rpms to location /zabbix_rpms/, --downloadonly will only download the package but not install them. --downloadonly option to set downloadonly, --downloaddir=/zabbix_rpms/ setting path to download.
yum install mysql-server mysql -y --downloadonly --downloaddir=/zabbix_rpms/
yum install zabbix-server-mysql zabbix-web-mysql -y --downloadonly --downloaddir=/zabbix_rpms/
yum install zabbix-agent  -y --downloadonly --downloaddir=/zabbix_rpms/
yum install createrepo -y --downloadonly --downloaddir=/zabbix_rpms/
To download all dependent rpms use repotrack.
repotrack -a x86_64 -p /zabbix_rpms/ [package]
There was a dependency on the remote server which was not resolving. So we download all the rpms recursively which resolved the issue.
[root@internet-access-server ahmed]# repotrack -a x86_64 -p /zabbix_rpms/  lm_sensors
Downloading basesystem-10.0-4.el6.noarch.rpm
Downloading bash-4.1.2-33.el6_7.1.x86_64.rpm
Downloading chkconfig-1.3.49.3-5.el6.x86_64.rpm
Downloading db4-4.7.25-20.el6_7.x86_64.rpm
Downloading dmidecode-2.12-6.el6.x86_64.rpm
Downloading filesystem-2.4.30-3.el6.x86_64.rpm
Downloading gdbm-1.8.0-38.el6.x86_64.rpm
Downloading glibc-2.12-1.166.el6_7.3.i686.rpm
Downloading glibc-2.12-1.166.el6_7.3.x86_64.rpm
Downloading glibc-common-2.12-1.166.el6_7.3.x86_64.rpm
Downloading libattr-2.4.44-7.el6.x86_64.rpm
Downloading libcap-2.16-5.5.el6.x86_64.rpm
Downloading libgcc-4.4.7-16.el6.i686.rpm
Downloading libgcc-4.4.7-16.el6.x86_64.rpm
Downloading libselinux-2.0.94-5.8.el6.x86_64.rpm
Downloading libsepol-2.0.41-4.el6.i686.rpm
Downloading libsepol-2.0.41-4.el6.x86_64.rpm
Downloading lm_sensors-3.1.1-17.el6.x86_64.rpm
Downloading lm_sensors-libs-3.1.1-17.el6.x86_64.rpm
Downloading ncurses-base-5.7-4.20090207.el6.x86_64.rpm
Downloading ncurses-libs-5.7-4.20090207.el6.x86_64.rpm
Downloading ncurses-libs-5.7-4.20090207.el6.i686.rpm
Downloading nss-softokn-freebl-3.14.3-23.el6_7.i686.rpm
Downloading nss-softokn-freebl-3.14.3-23.el6_7.x86_64.rpm
Downloading perl-5.10.1-141.el6_7.1.x86_64.rpm
Downloading perl-Module-Pluggable-3.90-141.el6_7.1.x86_64.rpm
Downloading perl-Perlilog-0.3-4.el6.noarch.rpm
Downloading perl-Pod-Escapes-1.04-141.el6_7.1.x86_64.rpm
Downloading perl-Pod-Simple-3.13-141.el6_7.1.x86_64.rpm
Downloading perl-libs-5.10.1-141.el6_7.1.x86_64.rpm
Downloading perl-libs-5.10.1-141.el6_7.1.i686.rpm
Downloading perl-version-0.77-141.el6_7.1.x86_64.rpm
Downloading popt-1.13-7.el6.x86_64.rpm
Downloading setup-2.8.14-20.el6_4.1.noarch.rpm
Downloading tzdata-2015g-2.el6.noarch.rpm
[root@internet-access-server ahmed]# cd /repos/packages/     

Transfer all rpms to the remote server.

First we archive it.
[root@internet-access-server /]# tar czf zabbix_rpms.tgz zabbix_rpms
Now send the archived file.
[root@internet-access-server /]# scp zabbix_rpms.tgz root@10.222.73.88:/tmp/
The authenticity of host '10.222.73.88 (10.222.73.88)' can't be established.
RSA key fingerprint is ed:a9:e2:50:6d:45:5b:bb:0f:2e:53:90:ee:86:f7:26.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '10.222.73.88' (RSA) to the list of known hosts.
root@10.222.73.88's password:
zabbix_rpms.tgz                                                     100%   23MB  30.2KB/s   13:05
[root@internet-access-server /]#

Create a repo on the remote server.

rpm -ivh deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm
rpm -ivh python-deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm
rpm -ivh createrepo-0.9.9-22.el6.noarch.rpm
Executing output.
[root@remote-zabbix-server ZBX_RPMS]# rpm -ivh deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm
warning: deltarpm-3.5-**6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID c105b9de: NOKEY
Preparing...                ########################################### [100%]
   1:deltarpm               ########################################### [100%]
[root@remote-zabbix-server ZBX_RPMS]# rpm -ivh python-deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm
warning: python-delta*t.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID c105b9de: NOKEY
Preparing...                ########################################### [100%]
   1:python-deltarpm        ########################################### [100%]
[root@remote-zabbix-server ZBX_RPMS]# rpm -ivh createrepo-0.9.9-22.el6.noarch.rpm
warning: createrepo-**ch.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
Preparing...                ########################################### [100%]
   1:createrepo             ########################################### [100%]
Create directory for RPMS.
mkdir -p /custom_repo/yum-channels/custom-repo-channel-sys/x86_64/
Create repo now.
createrepo /custom_repo/yum-channels/custom-repo-channel-sys/x86_64/

Update yum configuration.

Update configuration to make the new repo available to yum.

Setting up repo in /etc/yum.repos.d Location.

Create a file call custom-channel.repo here.
[custom-repo-channel-appsrc-repo] 
name=Custom Channel Sys Source Repository [ZABBIX]
baseurl=file:///custom_repo/yum-channels/custom-repo-channel-sys/x86_64
gpgcheck=0
enabled=1
proxy=_none_ 

Checking for the new repo added.

First we clean the repo.
[root@remote-zabbix-server x86_64]# yum clean all
Loaded plugins: product-id, security, subscription-manager
Cleaning repos: custom-repo-channel-appsrc-repo
Cleaning up Everything
Updating repolist now.
[root@remote-zabbix-server x86_64]# yum repolist
Loaded plugins: product-id, security, subscription-manager
custom-repo-channel-appsrc-repo                                               | 2.9 kB     00:00 ...
custom-repo-channel-appsrc-repo/primary_db                                    |  27 kB     00:00 ...
repo id                              repo name                                           status
custom-repo-channel-appsrc-repo      Custom Channel Sys Source Repository [ZABBIX]        28
repolist: 28
Checking for rpms from the newly created repo.
[root@remote-zabbix-server x86_64]# yum list zabbix-server-mysql
Loaded plugins: product-id, security, subscription-manager
Available Packages
zabbix-server-mysql.x86_64          2.4.7-1.el6                   custom-repo-channel-appsrc-repo
[root@remote-zabbix-server x86_64]#

Now we are ready to “Install”.

Standard installation instrutions in the link below.
http://ift.tt/1YMkhtJ

from Blogger http://ift.tt/1YMkhtL
via IFTTT

Categories: Others Tags: ,

Installing SNMP Builder using `zabbix-extra` on Zabbix Version 2.4.

December 30, 2015 Leave a comment
SNMP Builder/Extra is an add-in for Zabbix. It provides new web interface components to browse MIB trees and values. SNMP OIDs can then be automatically converted into Zabbix items and inserted into a template. The underlying snmpbuilder script uses calls to NetSNMP in order to communicate with devices on the network.
Maintainers: Zabbix forum members
Original Author: giapnguyen
Features
  • MIB Browser: you can select default MIB files or your own device MIBs to get an OID tree. Click on the tree to retrieve value and information about a OID. Click to transform the OID to a Zabbix item.
  • MIB Browser: uses snmpv2c to connect to remote devices using netSNMP module. To use snmpv1, modify the scripted SNMP calls to use v1 instead of v2c. v1/v2 change is not exposed in the php interface.
  • OID Table support: it assume that a OID whose name’s end with string ‘Table’ is a OID Table. OID Table will retrieve with all it’s indexes. Click on the cell to select the index as Zabbix’s item. If my above assumption is wrong, you can use the checkbox .view as table. to switch between table and normal view.
  • Column selection: On OID Table, click on a header will select a whole column as Zabbix’s items. It’s useful if you create SNMP template for a 48 ports switch 8-).
    Auto convert: This is implemented as a simple conversion from SNMP to Zabbix item.
For installation in a new Zabbix web interface will require only two steps:
  1. Download the Zabbix-ons installation script;
  2. Installation of Zabbix 2.1-ons;
Got this from http://ift.tt/1VoccWQ very helpful extra.
More on this extra in the link below.
http://ift.tt/1Vocayd
More setup information can be found here, but you might need to use google translate.
http://ift.tt/1YMkfSK
files
[root@localhost Downloads]# wget http://ift.tt/1VocaOt
[root@localhost Downloads]# unzip ZE2.1.zip
[root@localhost Downloads]# cd zabbix-extras-ZE2.1
[root@localhost zabbix-extras-ZE2.1]# pwd
/home/ahmed/Downloads/zabbix-extras-ZE2.1
[root@localhost zabbix-extras-ZE2.1]# ls -l
total 256
drwxrwxrwx 4 ahmed ahmed  4096 Dec  9 12:09 include
-rwxrw-rw- 1 ahmed ahmed 34904 Jan 13  2015 instalaExtras.sh
drwxrwxrwx 3 ahmed ahmed  4096 Dec  9 12:09 jqplot
-rwxrw-rw- 1 ahmed ahmed  2241 Jan 13  2015 README.md
-rwxrw-rw- 1 ahmed ahmed  1458 Jan 13  2015 zbxe-arvore.php
-rwxrw-rw- 1 ahmed ahmed  4234 Jan 13  2015 zbxe-cat-chart-builder.php
-rwxrw-rw- 1 ahmed ahmed 18438 Jan 13  2015 zbxe-cat.php
-rwxrw-rw- 1 ahmed ahmed 37946 Jan 13  2015 zbxe-em.php
-rwxrw-rw- 1 ahmed ahmed  1495 Jan 13  2015 zbxe-geolocation.php
-rwxrw-rw- 1 ahmed ahmed 54959 Jan 13  2015 zbxe-inicia-bd.php
-rwxrw-rw- 1 ahmed ahmed  4524 Jan 13  2015 zbxe_item_test.php
-rwxrw-rw- 1 ahmed ahmed  1471 Jan 13  2015 zbxe-logo.php
-rwxrw-rw- 1 ahmed ahmed  7944 Jan 13  2015 zbxe-ns.php
-rwxrw-rw- 1 ahmed ahmed 14348 Jan 13  2015 zbxe-sc.php
-rwxrw-rw- 1 ahmed ahmed 36114 Jan 13  2015 zbxe-snmp-builder.php
-rwxrw-rw- 1 ahmed ahmed  2030 Jan 13  2015 zbxe-translation-export.php

Now lets execute the script instalaExtras.sh.

[root@localhost zabbix-extras-ZE2.1]# sh instalaExtras.sh

Selecting Language.

Selecting Language.
instalaExtras.sh: line 784: unalias: rm: not found
-->Mensagem Versao do Linux - OK (centos - 6.6)

                        lZabbix Extras Installer [2.1.3]qqk
                        x Informe o idioma (Enter the     x
                        x language for the installer)     x
                        x lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk x
                        x x ( ) pt  Portugues / Brasil  x x
                        x x (*) en  English             x x
                        x mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj x
                        x                                 x
                        x                                 x
                        tqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqu
                        x     <  OK  >            x
                        mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj

Enter the path to zabbix web installation, usually it is /usr/share/zabbix/.

Web Path.
                        lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk
                        x This installer will add an extra menu to the   x
                        x end of the menu bar of your environment. For   x
                        x installation are needed to inform some         x
                        x parameters.                                    x
                        x Please enter the path to the zabbix frontend   x
                        x lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk x
                        x x/usr/share/zabbix/                          x x
                        x mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj x
                        tqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqu
                        x           <  OK  >                     x
                        mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj

URL to zabbix http://ift.tt/1YMkdtU, change it as per requirement.

Web URL.
                        lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk
                        x This installer will add an extra menu to the end of   x
                        x the menu bar of your environment. For installation    x
                        x are needed to inform some parameters.                 x
                        x Please enter the URL to the zabbix frontend (using    x
                        x localhost)                                            x
                        x lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk x
                        x xhttp://192.168.126.129/zabbix                      x x
                        x mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj x
                        tqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqu
                        x               <  OK  >                        x
                        mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj

Enter path for php.ini, by default it is in /etc/php.ini.

php.ini path.
                        lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk
                        x This installer will configure the PHP:        x
                        x short_open_tag, activating it. This step is   x
                        x required to install and ZabTree ZabGeo.       x
                        x Please enter the path to php.ini.             x
                        x lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk x
                        x x/etc/php.ini                               x x
                        x mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj x
                        tqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqu
                        x           <  OK  >                    x
                        mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj

Select downloading package from internet. Or we have to download all the packages from internet and save it in /tmp.

[root@zbx-master-server ~]# ls -l /tmp/plugin*
-rw-r--r-- 1 root root    7747 Dec  9 14:35 /tmp/pluginArvoreDaemon.zip
-rw-r--r-- 1 root root   14367 Dec  9 14:35 /tmp/pluginArvoreJS.zip
-rw-r--r-- 1 root root  144877 Dec  9 14:34 /tmp/pluginArvore.zip
-rw-r--r-- 1 root root     193 Dec  9 14:36 /tmp/pluginExtrasBD.htm
-rw-r--r-- 1 root root 1648347 Dec  9 14:36 /tmp/pluginExtras.zip
-rw-r--r-- 1 root root  125767 Dec  9 14:34 /tmp/pluginGeo.zip
-rw-r--r-- 1 root root  529784 Dec  9 14:35 /tmp/pluginSNMPB.zip
[root@zbx-master-server ~]#
Here are location for the downloads of there is no interenet connection the zabbix server.
    [root@zbx-master-server ~]# wget \
    http://ift.tt/1Vocddl \
    -O /tmp/pluginGeo.zip

    [root@zbx-master-server ~]# wget \
    http://ift.tt/1YMkdu5 -O /tmp/pluginArvore.zip

    [root@zbx-master-server ~]# wget \
    http://ift.tt/1VocaOD \
    -O /tmp/pluginArvoreDaemon.zip

    [root@zbx-master-server ~]# wget \
    http://ift.tt/1YMkdKp -O /tmp/pluginArvoreJS.zip

Currently we will select internet.

pkg from internet.
                        lqqqqqqqqqqqqqqqqqqqqqqqqqqDownload Filesqqqqqqqqqqqqqqqqqqqqqqqqqqqqk
                        x Download the patch files (S) (S = Yes)?                            x
                        x lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk x
                        x x (*) S  Get from internet latest version of patchs (recomended) x x
                        x x ( ) N  Use files saved in /tmp                                 x x
                        x mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj x
                        x                                                                    x
                        x                                                                    x
                        tqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqu
                        x                   <  OK  >                                 x
                        mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj

If we have installed this package earlier then we will get the below menu. [OPTIONAL].

older version.
                        lqqqZabbix Extras BD Update [2.1.3]qqqqqqk
                        x A previous installation was detected.  x
                        x Do you want to REPLACE the data from   x
                        x the tables by the new ZBXE data? If    x
                        x the installation is damaged you must   x
                        x choose this option!                    x
                        x lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk x
                        x x    ( ) S  Re-create zbxe tables    x x
                        x x    (*) N  Preserve zbxe tables     x x
                        x mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj x
                        x                                        x
                        x                                        x
                        tqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqu
                        x         <  OK  >               x
                        mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj

Downloading and setting up configuration.

-->Mensagem  Recriar banco [N]
-->Mensagem Configurando suporte a customizacoes nos mapas...
-->Mensagem  Upgrade install (cores mapa)...
-->Mensagem  Upgrade install (empresa)...
-->Mensagem  Upgrade install (funcao adicional para cores)...
-->Mensagem  Upgrade install (customizando cores padroes)...
-->Mensagem  Upgrade install (esconde titulo)...
-->Mensagem Configurando suporte a logotipo personalizado...
-->Mensagem  Upgrade install (logotipo)...
-->Mensagem  Upgrade install (Adicionando suporte para verificacao em tempo real de chave)...
-->Mensagem  Upgrade install (Adicionando botao para suporte a verificacao em tempo real de chave)...
-->Mensagem Configurando portlet com link para itens nao suportados...
-->Mensagem  Upgrade install (NS)...
--2015-12-09 14:34:22--  http://ift.tt/1Vocddl
Resolving github.com... 192.30.252.131
Connecting to github.com|192.30.252.131|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://ift.tt/1YMkdKt [following]
--2015-12-09 14:34:28--  http://ift.tt/1YMkdKt
Resolving codeload.github.com... 192.30.252.146
Connecting to codeload.github.com|192.30.252.146|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 125767 (123K) [application/zip]
Saving to: “/tmp/pluginGeo.zip”

100%[==========================================================>] 125,767     38.5K/s   in 3.2s

2015-12-09 14:34:37 (38.5 KB/s) - “/tmp/pluginGeo.zip” saved [125767/125767]

--2015-12-09 14:34:37--  http://ift.tt/1YMkdu5
Resolving github.com... 192.30.252.131
Connecting to github.com|192.30.252.131|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://ift.tt/1VocdtD [following]
--2015-12-09 14:34:42--  http://ift.tt/1VocdtD
Resolving codeload.github.com... 192.30.252.146
Connecting to codeload.github.com|192.30.252.146|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 144877 (141K) [application/zip]
Saving to: “/tmp/pluginArvore.zip”

100%[==========================================================>] 144,877     14.6K/s   in 9.7s

2015-12-09 14:34:58 (14.6 KB/s) - “/tmp/pluginArvore.zip” saved [144877/144877]

--2015-12-09 14:34:58--  http://ift.tt/1VocaOD
Resolving github.com... 192.30.252.131
Connecting to github.com|192.30.252.131|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://ift.tt/1YMkg9h [following]
--2015-12-09 14:35:03--  http://ift.tt/1YMkg9h
Resolving codeload.github.com... 192.30.252.146
Connecting to codeload.github.com|192.30.252.146|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 7747 (7.6K) [application/zip]
Saving to: “/tmp/pluginArvoreDaemon.zip”

100%[======================================================>] 7,747       21.3K/s   in 0.4s

2015-12-09 14:35:09 (21.3 KB/s) - “/tmp/pluginArvoreDaemon.zip” saved [7747/7747]

--2015-12-09 14:35:09--  http://ift.tt/1YMkdKp
Resolving github.com... 192.30.252.131
Connecting to github.com|192.30.252.131|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://ift.tt/1Vocb4Z [following]
--2015-12-09 14:35:14--  http://ift.tt/1Vocb4Z
Resolving codeload.github.com... 192.30.252.146
Connecting to codeload.github.com|192.30.252.146|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 14367 (14K) [application/zip]
Saving to: “/tmp/pluginArvoreJS.zip”

100%[=================================================>] 14,367      10.6K/s   in 1.3s

2015-12-09 14:35:21 (10.6 KB/s) - “/tmp/pluginArvoreJS.zip” saved [14367/14367]

--2015-12-09 14:35:22--  http://ift.tt/1YMkg9l
Resolving github.com... 192.30.252.131
Connecting to github.com|192.30.252.131|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://ift.tt/1VocdtH [following]
--2015-12-09 14:35:30--  http://ift.tt/1VocdtH
Resolving codeload.github.com... 192.30.252.146
Connecting to codeload.github.com|192.30.252.146|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 529784 (517K) [application/zip]
Saving to: “/tmp/pluginSNMPB.zip”

100%[=========================================================>] 529,784     55.1K/s   in 12s

2015-12-09 14:35:48 (42.9 KB/s) - “/tmp/pluginSNMPB.zip” saved [529784/529784]

-->Mensagem  Upgrade install (Adicionando scripts para o snmp-builder-1)...
-->Mensagem  Upgrade install (Adicionando scripts para o snmp-builder-2)...
-->Mensagem  Upgrade install (Adicionando scripts para o snmp-builder-2)...
--2015-12-09 14:35:49--  http://ift.tt/1YMkgpz
Resolving github.com... 192.30.252.131
Connecting to github.com|192.30.252.131|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://ift.tt/1VocdtL [following]
--2015-12-09 14:35:54--  http://ift.tt/1VocdtL
Resolving codeload.github.com... 192.30.252.146
Connecting to codeload.github.com|192.30.252.146|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1648347 (1.6M) [application/zip]
Saving to: “/tmp/pluginExtras.zip”

100%[==========================================================>] 1,648,347   98.5K/s   in 25s

2015-12-09 14:36:25 (65.2 KB/s) - “/tmp/pluginExtras.zip” saved [1648347/1648347]

-->Mensagem Iniciando banco de dados...
2015-12-09  http://ift.tt/1YMkgpD
Connecting to 192.168.126.129:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 193 [text/html]
Saving to: “/tmp/pluginExtrasBD.htm”

100%[===========================================================>] 193         --.-K/s   in 0s

2015-12-09 14:36:27 (49.6 MB/s) - “/tmp/pluginExtrasBD.htm” saved [193/193]

-->Mensagem Instalando patch de literais...
-->Mensagem Existe instalacao previa no arquivo... removendo customizacao do patch literal!
-->Mensagem Instalando tags identificadoras do menu...
-->Mensagem Instalando menus customizados...
-->Mensagem  Upgrade install (NS)...
-->Mensagem  Upgrade install (personalizando profile)...
-->Mensagem  Upgrade install (Ajustando fields para modo global)...
-->Mensagem  Upgrade install (Adicionando parametros personalizados)...
-->Mensagem  Upgrade install (profile.php Adicionando regra de negocio)...
-->Mensagem  Upgrade install (personalizando profile)...
-->Mensagem  Upgrade install (Ajustando fields para modo global)...
-->Mensagem  Upgrade install (Adicionando parametros personalizados)...
-->Mensagem  Clean install (users.php Adicionando regra de negocio)...
-->Mensagem  Upgrade install (Adicionando aba do extras no profile)...
-->Mensagem Parametros usados para instalacao:
-->Mensagem URL do Zabbix: [http://ift.tt/1YMkdtU]
-->Mensagem Path do frontend Zabbix: [/usr/share/zabbix/]
-->Mensagem Path do php.ini: [/etc/php.ini]
-->Mensagem Se for necessario suporte favor enviar, por e-mail, os arquivos abaixo:
-->Mensagem /tmp/pluginExtrasBD.htm
-->Mensagem /tmp/upgZabbix/logInstall.log
[root@zbx-master-server zabbix-extras-ZE2.1]#
Installation complete.

Now we add all the required MIBs in the directory below.

[root@zbx-master-server mibs]# pwd
/usr/share/zabbix/extras/snmp-builder/mibs
Once you add the MIBs to `, change the permission onmibsdirectory to777`
[root@zbx-master-server mibs]# cd /usr/share/zabbix/extras/snmp-builder/
[root@zbx-master-server snmp-builder]# chmod 777 -R mibs
And we are done, Now we should see all the MIBs in the SNMP Builder UI.

Next we see the result on the web UI.

Here is the UI screenshot. Now we can see an extra tab on top.
Web UI SNMP Builder
DONE!!

from Blogger http://ift.tt/1YMkgpF
via IFTTT

Categories: Others Tags: ,

Setting up SNMP Trapper for Zabbix.

December 3, 2015 1 comment
Receiving SNMP traps is the opposite to querying SNMP-enabled devices. In this case the information is sent from a SNMP-enabled device and is collected or “trapped” by Zabbix. Usually traps are sent upon some condition change and the agent connects to the server on port 162 (as opposed to port 161 on the agent side that is used for queries). Using traps may detect some short problems that occur amidst the query interval and may be missed by the query data.
Receiving SNMP traps in Zabbix is designed to work with snmptrapd and one of the built-in mechanisms for passing the traps to Zabbix – either a perl script or SNMPTT.
The workflow of receiving a trap:
  • snmptrapd receives a trap
  • snmptrapd passes the trap to SNMPTT or calls Perl trap receiver
  • SNMPTT or Perl trap receiver parses, formats and writes the trap to a file
  • Zabbix SNMP trapper reads and parses the trap file
  • For each trap Zabbix finds all “SNMP trapper” items with host interfaces matching the received trap address. Note that only the selected “IP” or “DNS” in host interface is used during the matching.
  • For each found item, the trap is compared to regexp in “snmptrap[regexp]”. The trap is set as the value of all matched items. If no matching item is found and there is an “snmptrap.fallback” item, the trap is set as the value of that.
    If the trap was not set as the value of any item, Zabbix by default logs the unmatched trap. (This is configured by “Log unmatched SNMP traps” in Administration -> General -> Other.)

Update firewall rules.

Setting up firewall 162 port should be opened. Add the following line in /etc/sysconfig/iptables:
-A INPUT -p udp -m udp --dport 162 -j ACCEPT
Restart Firewall.
[ahmed@nms ~]# service iptables restart

Setting up Zabbix to receive SNMP traps using zabbix_trap_receiver.pl.

Install additional packages
[ahmed@nms ~]# yum install -y net-snmp-utils net-snmp-perl
We will be using zabbix_trap_receiver.pl, File can be downloaded from HERE.
Copy the file to /usr/bin
[ahmed@nms ~]# cp zabbix_trap_receiver.pl /usr/bin
[ahmed@nms ~]# chmod +x /usr/bin/zabbix_trap_receiver.pl
Update snmptrapd.conf
[ahmed@nms ~]# vi /etc/snmp/snmptrapd.conf
Append below lines to snmptrapd.conf
authCommunity execute public
perl do "/usr/bin/zabbix_trap_receiver.pl";

Enable Zabbix SNMP trapper in Zabbix server configuration.

[ahmed@nms ~]# vi /etc/zabbix/zabbix_server.conf
Enable SNMP trap in zabbix_server.conf
StartSNMPTrapper=1
SNMPTrapperFile should be same as what it is in zabbix_trap_receiver.pl file.
SNMPTrapperFile=/tmp/zabbix_traps.tmp 
Restart Zabbix Server.
[ahmed@nms ~]# service zabbix-server restart

Setting snmptrapd to start on reboot.

Configure snmptrapd to start automatically:
[ahmed@nms ~]# chkconfig snmptrapd on
and restart snmptrapd service:
[ahmed@nms ~]# service snmptrapd restart

SNMP trap transmission file rotation (optional)

Create a directory to store the data.
[ahmed@nms ~]# mkdir -p /var/log/zabbix_traps_archive
[ahmed@nms ~]# chmod 777 /var/log/zabbix_traps_archive
Add below contents to /etc/logrotate.d/zabbix_traps.
/tmp/zabbix_traps.tmp {
    weekly
    size 10M
    compress
    compresscmd /usr/bin/bzip2
    compressoptions -9
    notifempty
    dateext
    dateformat -%Y%m%d
    missingok
    olddir /var/log/zabbix_traps_archive
    maxage 365
    rotate 10
}

Testing

Send test trap
[ahmed@nms ~]# snmptrap -v 1 -c public 127.0.0.1 '.1.3.6.1.6.3.1.1.5.4' '0.0.0.0' 6 33 '55' \
 .1.3.6.1.6.3.1.1.5.4 s "eth0"
and check that trap received in the /tmp/zabbix_traps.tmp.
PDU INFO:
  notificationtype               TRAP
  version                        0
  receivedfrom                   UDP: [127.0.0.1]:41840->[127.0.0.1]
  errorstatus                    0
  messageid                      0
  community                      public
  transactionid                  2
  errorindex                     0
  requestid                      0
VARBINDS:
  DISMAN-EVENT-MIB::sysUpTimeInstance type=67 value=Timeticks: (55) 0:00:00.55
  SNMPv2-MIB::snmpTrapOID.0      type=6  value=OID: IF-MIB::linkUp.0.33
  IF-MIB::linkUp                 type=4  value=STRING: "eth0"
  SNMP-COMMUNITY-MIB::snmpTrapCommunity.0 type=4  value=STRING: "public"
  SNMPv2-MIB::snmpTrapEnterprise.0 type=6  value=OID: IF-MIB::linkUp
We are done with setting up SNMP trapper.

Create a Template called “Template SNMP trap fallback”

Creating Item called “SNMP trap fallback“ in template “Template SNMP trap fallback
  • Name: SNMP trap fallback
  • Type: SNMP trap
  • Key: snmptrap.fallback
  • Type of information: Log
This item will collect all unmatched traps. Create trigger which will inform administrator about new unmatched traps:
  • Name: Unmatched SNMP trap received from {HOST.NAME}
  • Expression: {Template SNMP trap fallback:snmptrap.fallback.nodata(300)}=0

Complete zabbix_trap_receiver.pl File.

You can find the latest file from the link below.
#!/usr/bin/perl

#
# Zabbix
# Copyright (C) 2000-2011 Zabbix SIA
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
#

#########################################
#### ABOUT ZABBIX SNMP TRAP RECEIVER ####
#########################################

# This is an embedded perl SNMP trapper receiver designed for sending data to the server.
# The receiver will pass the received SNMP traps to Zabbix server or proxy running on the
# same machine. Please configure the server/proxy accordingly.
#
# Read more about using embedded perl with Net-SNMP:
#    http://ift.tt/21xObRx

#################################################
#### ZABBIX SNMP TRAP RECEIVER CONFIGURATION ####
#################################################

### Option: SNMPTrapperFile
#    Temporary file used for passing data to the server (or proxy). Must be the same
#    as in the server (or proxy) configuration file.
#
# Mandatory: yes
# Default:
$SNMPTrapperFile = '/tmp/zabbix_traps.tmp';

### Option: DateTimeFormat
#    The date time format in strftime() format. Please make sure to have a corresponding
#    log time format for the SNMP trap items.
#
# Mandatory: yes
# Default:
$DateTimeFormat = '%H:%M:%S %Y/%m/%d';

###################################
#### ZABBIX SNMP TRAP RECEIVER ####
###################################

use Fcntl qw(O_WRONLY O_APPEND O_CREAT);
use POSIX qw(strftime);

sub zabbix_receiver
{
    my (%pdu_info) = %{$_[0]};
    my (@varbinds) = @{$_[1]};

    # open the output file
    unless (sysopen(OUTPUT_FILE, $SNMPTrapperFile, O_WRONLY|O_APPEND|O_CREAT, 0666))
    {
        print STDERR "Cannot open [$SNMPTrapperFile]: $!\n";
        return NETSNMPTRAPD_HANDLER_FAIL;
    }

    # get the host name
    my $hostname = $pdu_info{'receivedfrom'} || 'unknown';
    if ($hostname ne 'unknown') {
        $hostname =~ /\[(.*?)\].*/;             # format: "UDP: [127.0.0.1]:41070->[127.0.0.1]"
        $hostname = $1 || 'unknown';
    }

    # print trap header
    #       timestamp must be placed at the beggining of the first line (can be omitted)
    #       the first line must include the header "ZBXTRAP [IP/DNS address] "
    #              * IP/DNS address is the used to find the corresponding SNMP trap items
    #              * this header will be cut during processing (will not appear in the item value)
    printf OUTPUT_FILE "%s ZBXTRAP %s\n", strftime($DateTimeFormat, localtime), $hostname;

    # print the PDU info
    print OUTPUT_FILE "PDU INFO:\n";
    foreach my $key(keys(%pdu_info))
    {
        printf OUTPUT_FILE "  %-30s %s\n", $key, $pdu_info{$key};
    }

    # print the variable bindings:
    print OUTPUT_FILE "VARBINDS:\n";
    foreach my $x (@varbinds)
    {
        printf OUTPUT_FILE "  %-30s type=%-2d value=%s\n", $x->[0], $x->[2], $x->[1];
    }

    close (OUTPUT_FILE);

    return NETSNMPTRAPD_HANDLER_OK;
}

NetSNMP::TrapReceiver::register("all", \&zabbix_receiver) or
    die "failed to register Zabbix SNMP trap receiver\n";

print STDOUT "Loaded Zabbix SNMP trap receiver\n";

from Blogger http://ift.tt/21xOeg5
via IFTTT

Categories: Others Tags: ,