Zabbix agent package for Solaris 10
Posted on September 10th, 2010
Hi there!
We are going to create zabbix agent package and use it for installing large number of zabbix clients.
First, download the source package, unpack it and install to some location.
Let’s suppose the location would be /soft/build/zabbix-agent
gunzip -cd zabbix-1.8.3.tar.gz | tar xf - cd zabbix-1.8.3 ./configure --enable-agent --disable-server --prefix=/soft/build/zabbix-agent make && make install
Now, copy Zabbix Solaris 10 package source files somewhere, for example to /soft/build/pkgsrc and execute make from there.
bash-2.05# make echo "i pkginfo" > prototype echo "i preinstall" >> prototype echo "i postinstall" >> prototype echo "i preremove" >> prototype echo "i postremove" >> prototype echo "i request" >> prototype echo PKG=ZABagent > pkginfo echo NAME=Zabbix agents >> pkginfo echo ARCH=sparc >> pkginfo echo VERSION=1.8.2 >> pkginfo echo CATEGORY=system >> pkginfo echo BASEDIR=/usr/local >> pkginfo echo PSTAMP=\"`date '+%m/%d/%Y'`\" >> pkginfo echo ZABBIX_SERVERS= >> pkginfo echo SUNW_PKG_ALLZONES=false >> pkginfo echo SUNW_PKG_THISZONE=true >> pkginfo pkgproto /soft/build/zabbix-agent=/usr/local >> prototype pkgmk -o -b /usr/local -r / ## Building pkgmap from package prototype file. ## Processing pkginfo file. WARNING: missing directory entry for WARNING: parameter set to "none" ## Attempting to volumize 14 entries in pkgmap. part 1 -- 3784 blocks, 19 entries ## Packaging one part. /var/spool/pkg/ZABagent/pkgmap /var/spool/pkg/ZABagent/pkginfo /var/spool/pkg/ZABagent/root/usr/local/bin/zabbix_get /var/spool/pkg/ZABagent/root/usr/local/bin/zabbix_sender /var/spool/pkg/ZABagent/root/usr/local/sbin/zabbix_agent /var/spool/pkg/ZABagent/root/usr/local/sbin/zabbix_agentd /var/spool/pkg/ZABagent/root/usr/local/share/man/man1/zabbix_get.1 /var/spool/pkg/ZABagent/root/usr/local/share/man/man1/zabbix_sender.1 /var/spool/pkg/ZABagent/root/usr/local/share/man/man8/zabbix_agentd.8 /var/spool/pkg/ZABagent/install/postinstall /var/spool/pkg/ZABagent/install/postremove /var/spool/pkg/ZABagent/install/preinstall /var/spool/pkg/ZABagent/install/preremove /var/spool/pkg/ZABagent/install/request ## Validating control scripts. ## Packaging complete. pkgtrans /var/spool/pkg Zabbix-agent-sol10-sparc.pkg ZABagent Transferring package instance bash-2.05#
The package will be sitting in /var/spool/pkg. It made zone aware by defining 2 variables in pkginfo file:
SUNW_PKG_ALLZONES=false SUNW_PKG_THISZONE=true
And will be installed only in zone you are running pkgadd from.
Install it. Example log output follows:
bash-3.00# pkgadd -d /var/tmp/Zabbix-agent-sol10-sparc.pkg
The following packages are available:
1 ZABagent Zabbix agents
(sparc) 1.8.2
Select package(s) you wish to process (or 'all' to process
all packages). (default: all) [?,??,q]:
Processing package instance from
## Installing package in global zone
Zabbix agents(sparc) 1.8.2
Enter a zabbix server ip address [no more]:
This is not an IP address.
Enter a zabbix server ip address [no more]: 10.50.2.199
Enter a zabbix server ip address [no more]:
## Processing package information.
## Processing system information.
1 package pathname is already properly installed.
## Verifying disk space requirements.
## Checking for conflicts with packages already installed.
The following files are already installed on the system and are being
used by another package:
/usr/local
/usr/local/bin
/usr/local/sbin
/usr/local/share
/usr/local/share/man
/usr/local/share/man/man1
Do you want to install these conflicting files [y,n,?,q] y
## Checking for setuid/setgid programs.
This package contains scripts which will be executed with super-user
permission during the process of installing this package.
Do you want to continue with the installation of [y,n,?] y
Installing Zabbix agents as
## Executing preinstall script.
## Installing part 1 of 1.
/usr/local/bin/zabbix_get
/usr/local/bin/zabbix_sender
/usr/local/sbin/zabbix_agent
/usr/local/sbin/zabbix_agentd
/usr/local/share/man/man1/zabbix_get.1
/usr/local/share/man/man1/zabbix_sender.1
/usr/local/share/man/man8/zabbix_agentd.8
[ verifying class ]
## Executing postinstall script.
Installation of was successful.
bash-3.00#Package will create smf service and start it automatically. Check this out.
bash-3.00# svcs -a | grep zab online 12:54:10 svc:/application/zabbix-agent:default bash-3.00#
Next, we are going to automate installation process to avoid asking questions completely. We will use pkgask(1) command for that. First, we create response file which we can use later for automated install.
bash-3.00# pkgask -r /tmp/zab.ask -d /var/tmp/Zabbix-agent-sol10-sparc.pkg
The following packages are available:
1 ZABagent Zabbix agents
(sparc) 1.8.2
Select package(s) you wish to process (or 'all' to process
all packages). (default: all) [?,??,q]:
Processing package instance from
## Installing package in global zone
Zabbix agents(sparc) 1.8.2
Enter a zabbix server ip address [no more]: 10.50.2.199
Enter a zabbix server ip address [no more]:
Response file was created.
Processing of request script was successful.Next, create admin file. Copy sample from default to say /tmp and edit it.
cp /var/sadm/install/admin/default /tmp/zab.admin vi !$
Make it not to ask anything. For example like this:
ail= instance=unique partial=ask runlevel=ask idepend=ask rdepend=ask space=ask setuid=nocheck conflict=nocheck action=nocheck networktimeout=60 networkretries=3 authentication=quit keystore=/var/sadm/security proxy= basedir=default
And, finally, install the package using admin file and response file we just created.
bash-3.00# pkgadd -d /var/tmp/Zabbix-agent-sol10-sparc.pkg -r /tmp/zab.ask -a /tmp/zab.admin all Processing package instance from ## Installing package in global zone Zabbix agents(sparc) 1.8.2 ## Processing package information. ## Processing system information. 7 package pathnames are already properly installed. ## Verifying disk space requirements. Installing Zabbix agents as ## Executing preinstall script. ## Installing part 1 of 1. /usr/local/bin/zabbix_get /usr/local/bin/zabbix_sender /usr/local/sbin/zabbix_agent /usr/local/sbin/zabbix_agentd /usr/local/share/man/man1/zabbix_get.1 /usr/local/share/man/man1/zabbix_sender.1 /usr/local/share/man/man8/zabbix_agentd.8 [ verifying class ] ## Executing postinstall script. Installation of was successful.
As you can see no questions was asked at all. So you can use the procedure to do mass installs of the package. You could also download Zabbix Solaris 10 binary package
made using using this instructions.
Tags: solaris zabbix
Filed under Installation and Upgrade, Packages, Zabbix | 3 Comments »
Creating Net-SNMP 5.5 package for Solaris 10
Posted on July 6th, 2010
Recently I’ve discovered a bug in net-snmp version 5.4, which I’ve downloaded from sunfreeware. So as there was no most recent version of net-snmp package I’ve decided to build it myself.
First, unpack the source, configure and install it into some location, for example in this case it will be
/soft/build/net-snmp/sparc
gunzip -cd net-snmp-5.5.tar.gz | tar xf - ./configure --prefix=/soft/build/net-snmp/sparc/usr/local \ --execprefix=/soft/build/net-snmp/sparc/usr/local make make install
Create smf starter script
#!/bin/sh . /lib/svc/share/smf_include.sh # Start processes required for snmpd if [ -x /usr/local/sbin/snmpd ]; then /usr/local/sbin/snmpd else echo "snmpd is missing or not executable." exit $SMF_EXIT_ERR_CONFIG fi exit $SMF_EXIT_OK
and place it in there too
mkdir -p /soft/build/net-snmp/sparc/lib/svc/method cp svc-net-snmp /soft/build/net-snmp/sparc/lib/svc/method
Next, create some dir and place these file into it
Makefile depend postinstall preremove
Makefile:
all:
echo "i pkginfo" > prototype
echo "i postinstall" >> prototype
echo "i preremove" >> prototype
echo "i depend" >> prototype
echo PKG=NetSNMP-5-5-sol10-sparc > pkginfo
echo NAME=NetSNMP package >> pkginfo
echo ARCH=sparc >> pkginfo
echo VERSION=5.5 >> pkginfo
echo CATEGORY=system >> pkginfo
echo BASEDIR=/usr/local >> pkginfo
echo PSTAMP=\"`date '+%m/%d/%Y'`\" >> pkginfo
pkgproto /soft/build/net-snmp/sparc=/ >> prototype
pkgmk -o -b / -r /
pkgtrans /var/spool/pkg NetSNMP-5.5-sol10-sparc.pkg NetSNMP-5-5-sol10-sparcdepend:
P SMCossl OpenSSL P SMClgcc346 libgcc
postinstall:
#!/bin/sh
cat >/tmp/snmp.xml<<EOF
<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<service_bundle type='manifest' name='net-snmp'>
<service name='system/net-snmp' type='service' version='1'>
<create_default_instance enabled='false' />
<single_instance/>
<dependency name='milestone' grouping='require_all' restart_on='none' type='service'>
<service_fmri value='svc:/milestone/sysconfig' />
</dependency>
<dependency name='filesystem' grouping='require_all' restart_on='none' type='service'>
<service_fmri value='svc:/system/filesystem/local' />
</dependency>
<dependency name='name-services' grouping='require_all' restart_on='none' type='service'>
<service_fmri value='svc:/milestone/name-services' />
</dependency>
<dependent name='net-snmp_single-user' grouping='optional_all' restart_on='none'>
<service_fmri value='svc:/milestone/multi-user' />
</dependent>
<exec_method type='method' name='start' exec='/lib/svc/method/svc-net-snmp' timeout_seconds='60' />
<exec_method type='method' name='stop' exec=':kill' timeout_seconds='60' />
<exec_method type='method' name='refresh' exec=':kill -HUP' timeout_seconds='60' />
<property_group name='general' type='framework'>
<propval name='action_authorization' type='astring' value='solaris.smf.manage.net-snmp' />
</property_group>
<stability value='Unstable' />
<template>
<common_name>
<loctext xml:lang='C'>net-snmp</loctext>
</common_name>
<documentation>
<manpage title='net-snmp' section='1M' manpath='/usr/share/man' />
</documentation>
</template>
</service>
</service_bundle>
EOF
svccfg import /tmp/snmp.xml
svcadm enable net-snmp
rm /tmp/snmp.xmlpreremove:
svcadm disable -s net-snmp svccfg delete net-snmp
Next, make the package.
Filed under Nagios, Packages | No Comments »