Kerya techblog

Most Read Posts

  • Gentoo mail (postfix + postfixadmin + dovecot + amavisd-new + roundcube)
  • Zabbix - no such instance currently exists at this oid
  • LVM cant Boot - ALERT /dev/mapper/ubuntu--vg-root does not exist DROPPING to Shell -
  • liquidsoap-1.1.1 gentoo install
  • Laravel manual user register
  • Gentoo: php 5.6.0 + pecl-memcached 2.2.0 install script
  • Zabbix APC Smart UPS monitoring on FreeBSD with snmp
  • Squid 3.4 debian 7 install script
  • Подключение Foxgate S6224-S2 Ubuntu minicom
  • Abills
  • exim+dovecot+postfixadmin+clamav+spamassassin on FreeBSD
  • Openmeetings 2.1.1 Ubuntu 12.04.2 installation
  • libtool version mismatch pecl gentoo
  • Securing NTP
  • FreeBSD 9 ossec setup errors fix
  • fix for - corrupted record for package (pkgdep line without argument), ignoring
  • snmpd less verbose log FreeBSD (Connection from UDP messages)
  • Mikrotik no-ip ddns update script
  • Скопировать права mysql gentoo
  • mysql backup scripts
  1. Вы здесь:  
  2. Home
  • Home
  • Все статьи

Zabbix APC Smart UPS monitoring on FreeBSD with snmp

Подробности
Автор: Kirill

Создаем такого содержания файл /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

Squid 3.4 debian 7 install script

Подробности
Автор: Kirill

#!/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

 

Gentoo: php 5.6.0 + pecl-memcached 2.2.0 install script

Подробности
Автор: Kirill
  • gentoo
  • php
  • pecl
  • memcached

При стандартной компиляции может вылезти ошибка:

# 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    

Nginx redirects

Подробности
Автор: Kirill
  1. Почему я никогда больше не куплю смартфон Gigabyte
  2. Скрипт переполучения IP адреса на perl

Страница 13 из 17

  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17

Search

Older Posts

  • Greenbone Vulnerability Manager (GVM) hacks (63)
  • elasticsearch cluster red status fix due to high watermark (61)
  • ubuntu arrow keys misbehaviour fix (72)
  • icinga IIS monitoring powershell error Get-WmiObject : Invalid namespace "root\WebAdministration" (84)
  • Make user superadmin in zabbix (81)
  • dnf Error: unknown option (111)
  • unpack pfx certificate (used for apache or nginx) (116)
  • mysql audit plugin build script (290)
  • mysql dump one row (95)
  • redmine 5 docker-compose (199)
  • gitlab runner dind docker-compose (143)
  • AWS S3 IAM policy to limit to single sub folder (146)
  • logrotate hints (197)
  • bash script to clean files to required percentage (322)
  • Ansible create LVM and mount (732)

Login Form

  • Забыли пароль?
  • Забыли логин?
  • Регистрация