Создаем такого содержания файл /usr/local/scripts/apcupsd-stats :
#!/usr/local/bin/perl -w # Copyright (C) 2009 Glen Pitt-Pladdy # # 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. # # # # See: http://www.pitt-pladdy.com/blog/_20100320-215243_0000_apcupsd_stats_on_Cacti_via_SNMP_/ # open AC, "/usr/local/sbin/apcaccess status localhost |" or die "FATAL: can't run \"/usr/local/sbin/apcaccess\": $!\n"; while ( defined ( $line = <AC> ) ) { chomp $line; if ( $line !~ /^(\w+)\s*:\s*([^\s]+)/ ) { next; } $field{$1} = $2; } close AC; print "$field{LINEV}\n"; print "$field{OUTPUTV}\n"; print "$field{LOTRANS}\n"; print "$field{HITRANS}\n"; print "$field{BATTV}\n"; print "$field{NOMBATTV}\n"; print "$field{BCHARGE}\n"; print "$field{TIMELEFT}\n"; print "$field{LOADPCT}\n"; print "$field{LINEFREQ}\n"; #print "$field{ITEMP}\n"; #print ''.($field{'NOMPOWER'}*$field{'LOADPCT'}/100)."\n"; #print "$field{NOMPOWER}\n"; #if ( $field{'STATUS'} eq 'ONLINE' ) { # print "100\n0\n"; #} else { # print "0\n100\n"; #}
Некоторые модели не показывают температуру, как, например 420, поӕтому строку с температурой комментируем :-)
#print "$field{ITEMP}\n";
Делаем скрипт исполняемым
Read more: Zabbix APC Smart UPS monitoring on FreeBSD with snmp
#!/bin/bash
version='3.4.7'
prefix='/usr'
#prefix='/usr/local/squid-'${version}
if [ ! -f squid-$version.tar.xz ] ; then
wget http://www.squid-cache.org/Versions/v3/3.4/squid-$version.tar.xz
fi
if [ ! -d squid-$version ]; then
tar xvf squid-$version.tar.xz
fi
cd squid-$version
./configure \
--prefix=${prefix} \
--localstatedir=/var \
--srcdir=. \
--sysconfdir=/etc/squid \
--with-default-user=proxy \
--with-logdir=/var/log/squid \
--with-pidfile=/var/run/squid.pid \
--libexecdir=${prefix}/lib/squid \
--datadir=${prefix}/share/squid
make -j 30
make install
chown proxy /var/log/squid
При стандартной компиляции может вылезти ошибка:
# make
/bin/sh /usr/src/memcached-2.2.0/libtool --mode=compile cc -I/usr/lib64/php5.6/include/php -I. -I/usr/src/memcached-2.2.0 -DPHP_ATOM_INC -I/usr/src/memcached-2.2.0/include -I/usr/src/memcached-2.2.0/main -I/usr/src/memcached-2.2.0 -I/usr/lib64/php5.6/include/php -I/usr/lib64/php5.6/include/php/main -I/usr/lib64/php5.6/include/php/TSRM -I/usr/lib64/php5.6/include/php/Zend -I/usr/lib64/php5.6/include/php/ext -I/usr/lib64/php5.6/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /usr/src/memcached-2.2.0/php_memcached.c -o php_memcached.lo
/usr/src/memcached-2.2.0/libtool: line 482: CDPATH: command not found
libtool: Version mismatch error. This is libtool 2.4.2, but the
libtool: definition of this LT_INIT comes from an older release.
libtool: You should recreate aclocal.m4 with macros from libtool 2.4.2
libtool: and run autoconf again.
make: *** [php_memcached.lo] Error 63
Это лечится запуском
aclocal && libtoolize --force && autoreconf
между phpize и ./configure
Скрипт установки:
--------------------------------------------------------------------------------------------------
#!/bin/bash
cd /usr/src
wget http://pecl.php.net/get/memcached-2.2.0.tgz
tar xvf memcached-2.2.0.tgz
cd memcached-2.2.0
phpize
aclocal && libtoolize --force && autoreconf
./configure
make
make install
if [ ! -f /etc/php/fpm-php5.6/ext/memcached.ini ];
then
echo "extension=memcached.so" > /etc/php/fpm-php5.6/ext/memcached.ini
fi
cd /etc/php/fpm-php5.6/ext-active
ln -s ../ext/memcached.ini memcached.ini
if [ ! -f /etc/php/cli-php5.6/ext/memcached.ini ];
then
echo "extension=memcached.so" > /etc/php/fpm-php5.6/ext/memcached.ini
fi
cd /etc/php/cli-php5.6/ext-active
ln -s ../ext/memcached.ini memcached.ini