Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37564556
en ru br
Репозитории ALT

Группа :: Мониторинг
Пакет: nagios-plugins-nginx

 Главная   Изменения   Спек   Патчи   Исходники   Загрузить   Gear   Bugs and FR  Repocop 

pax_global_header00006660000000000000000000000064116505307620014517gustar00rootroot0000000000000052 comment=b39721c4c1a70dc5bb437f9c381ed0c66a733fa9
nagios-plugins-nginx-1.0.1/000075500000000000000000000000001165053076200155745ustar00rootroot00000000000000nagios-plugins-nginx-1.0.1/.gear/000075500000000000000000000000001165053076200165705ustar00rootroot00000000000000nagios-plugins-nginx-1.0.1/.gear/rules000064400000000000000000000000071165053076200176420ustar00rootroot00000000000000tar: .
nagios-plugins-nginx-1.0.1/check_nginx000075500000000000000000000065011165053076200200040ustar00rootroot00000000000000#!/usr/bin/python
# -*- coding: utf-8 -*-
# check_nginx is a Nagios to monitor nginx statu
# my blog: http://www.nginxs.com
# The version is 1.0.1
# MSN: yangzi2008@126.com

import string
import urllib2
import getopt
import sys

def usage():
print """check_nginx is a Nagios to monitor nginx status
Usage:

check_nginx [-h|--help][-U|--url][-P|--path][-u|--user][-p|--passwd][-w|--warning][-c|--critical]

Options:
--help|-h)
print check_nginx help.
--url|-U)
Sets nginx status url.
--path|-P)
Sets nginx status url path. Default is: off
--user|-u)
Sets nginx status BasicAuth user. Default is: off
--passwd|-p)
Sets nginx status BasicAuth passwd. Default is: off
--warning|-w)
Sets a warning level for nginx Active connections. Default is: off
--critical|-c)
Sets a critical level for nginx Active connections. Default is: off
Example:
The url is www.nginxs.com/status
./check_nginx -U www.nginxs.com -P /status -u eric -p nginx -w 1000 -c 2000
if dont't have password:
./check_nginx -U www.nginxs.com -P /status -w 1000 -c 2000
if don't have path and password:
./check_nginx -U www.nginxs.com -w 1000 -c 2000"""

sys.exit(3)

try:
options,args = getopt.getopt(sys.argv[1:],"hU:P:u:p:w:c:",["help","url=","path=","user=","passwd=","warning=","critical="])

except getopt.GetoptError:
usage()
sys.exit(3)

for name,value in options:
if name in ("-h","--help"):
usage()
if name in ("-U","--url"):
url = "http://"+value
if name in ("-P","--path"):
path = value
if name in ("-u","--user"):
user = value
if name in ("-p","--passwd"):
passwd = value
if name in ("-w","--warning"):
warning = value
if name in ("-c","--critical"):
critical = value
try:
if 'path' in dir():
req = urllib2.Request(url+path)
else:
req = urllib2.Request(url)
if 'user' in dir() and 'passwd' in dir():
passman = urllib2.HTTPPasswordMgrWithDefaultRealm()
passman.add_password(None, url+path, user, passwd)
authhandler = urllib2.HTTPBasicAuthHandler(passman)
opener = urllib2.build_opener(authhandler)
urllib2.install_opener(opener)
response = urllib2.urlopen(req)
the_page = response.readline()
conn = the_page.split()
ActiveConn = conn[2]
the_page1 = response.readline()
the_page2 = response.readline()
the_page3 = response.readline()
response.close()
b = the_page3.split()
reading = b[1]
writing = b[3]
waiting = b[5]
output = 'ActiveConn:%s,reading:%s,writing:%s,waiting:%s' % (ActiveConn,reading,writing,waiting)
perfdata = 'ActiveConn:%s,reading:%s,writing:%s,waiting:%s' % (ActiveConn,reading,writing,waiting)

except Exception:
print "NGINX STATUS unknown: Error while getting Connection"
sys.exit(3)
if 'warning' in dir() and 'critical' in dir():
if ActiveConn >= warning:
print 'WARNING - %s|%s' % (output,perfdata)
sys.exit(2)
elif ActiveConn >= critical:
print 'CRITICAL - %s|%s' % (output,perfdata)
sys.exit(1)
else:
print 'OK - %s|%s' % (output,perfdata)
sys.exit(0)
else:
print 'OK - %s|%s' % (output,perfdata)
sys.exit(0)
nagios-plugins-nginx-1.0.1/nagios-plugins-nginx.spec000064400000000000000000000014621165053076200225330ustar00rootroot00000000000000Name: nagios-plugins-nginx
Version: 1.0.1
Release: alt1.1

Summary: Nagios(R) plug-in for checking nginx status
License: GPL
Group: Monitoring

Url: http://www.nginxs.com/linux/441.html

Packager: Vitaly Lipatov <lav@altlinux.ru>

Source: %name-%version.tar

BuildArchitectures: noarch

Requires: nagios-nrpe

# nagios uses /usr/lib for plugins in any arch
%define plugindir %_prefix/lib/nagios/plugins

%description
Nagios plugin for checking nginx status written in python.

%prep
%setup

%install
mkdir -p %buildroot%plugindir/
install -m755 check_nginx %buildroot%plugindir/

%files
%plugindir/check_nginx

%changelog
* Sat Oct 22 2011 Vitaly Kuznetsov <vitty@altlinux.ru> 1.0.1-alt1.1
- Rebuild with Python-2.7

* Wed May 04 2011 Vitaly Lipatov <lav@altlinux.ru> 1.0.1-alt1
- initial build for ALT Linux Sisyphus
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin