2012년 11월 16일 금요일

php 보안 관련 php.ini 설정

보안업체에서 제공한 php 보안 옵션.

php.ini 의 설정 값을 아래와 같이 맞춘다.

allow_url_fopen = Off
safe_mode = On
register_globals = Off
magic_quotes_gpc = On
display_errors = Off

 

기존의 사용하고 있는 것들은 이렇게 변경시 제대로 동작 하지 않는 경우가 상당할 듯 하다.

새롭게 설치하는 서버의 경우 위와 같이 설정하고, 개발도 보안에 맞게끔 해야 한다.

2012년 11월 13일 화요일

특정 아이피 연결 끊기

특정 아이피에 대한 커넥션을을 끊어야 할 경우 tcpkill 명령을 사용하면 된다고 한다.

tcpkill은 dsniff 패키지에 포함 되어 있다.

설치방법

tcpkill 이 필요한 서버(CentOS release 5.7 (Final))에서 libnids가 yum 으로 설치되지 않는다.
해서 그냥 명령어 조합으로 사용해서 썼는 데, 그냥 저냥 유용한 것 같다.
lsof -n -i@194.219.126.61 | awk {'print $2'} | xargs kill -9
아이피 부분만 바꿔서 사용하면 된다.

 

2012년 11월 7일 수요일

L4 로드밸런싱 구성후 속도 느린 현상

Nortel Application Switch 3408 과 시스코 2950 스위치를 이용하여 로드밸런싱으로 구성하였다.

대체적으로 문제는 없는 데, 클라이언트 측에서 홈페이지 속도가 느리다고 함.

우리 사무실은 빠름..ㄷㄷ;

일단 예전의 기억을 더듬어 스위치의 Speed 와 duplex 확인.

업링크 포트인 24번 포트가 Duplex 가 Half로 잡혀 있음.. ㄷㄷ;

일단 Half를 Full로 설정 함.

이때 잠깐 네트워크 다운 됬다 올라오는 데, 네트워크가 죽어버린 줄 알고 식겁함. ㄷㄷ;

설정 완료하고, 클라이언트 측에 연락.

빨라 졌다고 하는 데, 내 컴퓨터에서는 원래부터 빨라서, 이거 문제인지 애매함.

 

2012.12.03  추가

사용자가 늘어나니 느려지는 현상 발생.

서버쪽에는 로드가 많지 않음.

스위치 로그 확인.

duplex mismatch discovered on FastEthernet0/24 (not half duplex), with Reno_Backbone GigabitEthernet6/18 (half duplex).
L4쪽 포트외에 백본 스위치의 포트 역시 맞춰줘야 했음.

L4와 L2간에는 is experiencing errors


 

2012년 11월 6일 화요일

Plugin "refresh-packagekit" can't be imported

yum을 이용하려고 보니 에러메시지가 뜬다.
[root@localhost ~]# yum list
Plugin "refresh-packagekit" can't be imported
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
* base: centos.mirror.cdnetworks.com
* extras: centos.mirror.cdnetworks.com
* updates: centos.mirror.cdnetworks.com
Traceback (most recent call last):
File "/usr/bin/yum", line 29, in <module>
yummain.user_main(sys.argv[1:], exit_code=True)
File "/usr/share/yum-cli/yummain.py", line 285, in user_main
errcode = main(args)
File "/usr/share/yum-cli/yummain.py", line 136, in main
result, resultmsgs = base.doCommands()
File "/usr/share/yum-cli/cli.py", line 434, in doCommands
self._getTs(needTsRemove)
File "/usr/lib/python2.6/site-packages/yum/depsolve.py", line 99, in _getTs
self._getTsInfo(remove_only)
File "/usr/lib/python2.6/site-packages/yum/depsolve.py", line 110, in _getTsInfo
pkgSack = self.pkgSack
File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 897, in <lambda>
pkgSack = property(fget=lambda self: self._getSacks(),
File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 682, in _getSacks
self.repos.populateSack(which=repos)
File "/usr/lib/python2.6/site-packages/yum/repos.py", line 294, in populateSack
sack.populate(repo, mdtype, callback, cacheonly)
File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 165, in populate
if self._check_db_version(repo, mydbtype):
File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 223, in _check_db_version
return repo._check_db_version(mdtype)
File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 1256, in _check_db_version
repoXML = self.repoXML
File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 1455, in <lambda>
repoXML = property(fget=lambda self: self._getRepoXML(),
File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 1447, in _getRepoXML
self._loadRepoXML(text=self)
File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 1437, in _loadRepoXML
return self._groupLoadRepoXML(text, self._mdpolicy2mdtypes())
File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 1412, in _groupLoadRepoXML
if self._commonLoadRepoXML(text):
File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 1240, in _commonLoadRepoXML
self._repoXML = self._parseRepoXML(result)
File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 1036, in _parseRepoXML
return repoMDObject.RepoMD(self.id, local)
File "/usr/lib/python2.6/site-packages/yum/repoMDObject.py", line 124, in __init__
self.parse(srcfile)
File "/usr/lib/python2.6/site-packages/yum/repoMDObject.py", line 140, in parse
parser = iterparse(infile)
File "/usr/lib/python2.6/site-packages/yum/misc.py", line 1169, in cElementTree_iterparse
_cElementTree_import()
File "/usr/lib/python2.6/site-packages/yum/misc.py", line 1164, in _cElementTree_import
import cElementTree
ImportError: No module named cElementTree

 

원인은 오라클 설치시 지정한 $LD_LIBRARY_PATH 문제이다.

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH

profile 이렇게 지정하고 지정하고 사용하는 데, 문제는 오라클 먼저 찾고 나서 그다음 시스템의 경로를 찾는 데, 오라클 라이브러리 경로의 libexpat가 있으니까 이걸로 yum 실행하는 데,

이게 아니라 시스템의 라이브러리 패스를 찾아야 하는 맞게 동작하는 것이다.
export LD_LIBRARY_PATH=/lib64/

위 명령어를 실행 후 하면 제대로 동작한다.

 

 

 

2012년 10월 31일 수요일

swfupload 에 addPostParam 작동 안되는 문제.

진짜 간단한 문제인 데, 이것 때문에 이틀 날렸음;;

setting 값에  use_query_string : true, 를 추가.

위의 값은 기본이 false 이므로 추가가 필요하고,

addPostParam 뿐만 아니라,post_params를 이용하기 위해서도 true로 설정 해야 한다.

2012년 10월 11일 목요일

L2 스위치 포트별 아이피 찾기 프로그램 (포트매핑)

L2 스위치에선 포트별 아이피를 찾을 수 없는 데, 이걸 L3장비와 연계하여 찾는 프로그램(포트매핑)을 만들어 봤다.

포항공과대학의 김은희님이 쓰신 논문이 유용한 자료가 되었다.

해당 논문에서 처럼 제대로 된 프로그램으로 만들고 싶지만, 이미 상용프로그램이 많은 상황에서 그정도의 퀄리티를 뛰어넘을 자신도 없고, 그냥 구현 해 본데에 의의를 둔다.

이미 상용으로 솔라윈즈나 OpUtils 등에 해당 기능이 포함되어 있다.

솔라윈즈의 switch port mapper 프로그램과 비교하여 보니, 정확히 비슷하진 않지만, 얼추 맞는 것으로 보인다.

문제 있을 수 있는점.
1. vlan 별로 별도 지정이 안되있어서, vlan을 추가한 L2장비에서는 어떻게 될 지 모르겠다.
2. 구글 검색하다가 보게 된건데, 시스코외의 장비에서는 조금 다른 MIB 를 사용하고 있는 것 같다.(표준MIB라고 해서 사용하기 했는 데, 잘 모르겠다.)

ps.
php 를 통해 구현했는데,  보통 호스팅으로 사용하는 서버에는 snmp 내장함수가 설치되어 있지 않다.

 

DEMO

 다운로드

2012년 10월 2일 화요일

MRTG cpu,mem,hdd,load average,active user, process,traffic 템플릿

아래의 출처에서 다운받은 템플릿.

해당 템플릿을 다운 받고 cfgmaker 에서 옵션을 --host-template=host-generic.htp 추가하여 사용하면된다.

다만 해당사이트에서 다운받은 템플릿으로 생성한 cfg 파일을 indexmaker로 만들때 아래와 같은 에러메시지가 뜬다.

ERROR: no H1 line pagetop property in 아이피-memory section

indexmaker에서 pagetop 옵션에는 H1 태그로 찾는 게 기본값인데, 해당 템플릿에서는 H1 지정이 안되어 있다.

해당 문제는 -section 옵션으로 해결할 수 있다.

아래의 옵션중에 h1 외의 옵션으로 설정하여 실행하면 된다.


 - section = h1 섹션의 헤딩으로 PageTop에 h1 태그를 사용 (기본값)
- section = title 그래프 섹션 헤딩으로 Title을 사용
- section = name 섹션 헤딩으로 그래프 이름을 사용
- section = descr 섹션 헤딩으로 그래프 description을 사용
- section = portname 섹션 헤딩으로 PageTop에 port 이름 항목을 사용


아래는 H1 태그 추가한 버젼.



# Generic host template for all systems support MIB-II host resources
# MIB. Will take care of storage devices as well, but watch out for
# changes in enumeration caused by inserting USB devices!

# Watch out for lines being wrapped by broken editing software

$head_lines .= "#---------------------------------------------------------------------\n";

if( $sysdescr =~ /linux/i ) {
$target_lines .= "routers.cgi*Icon: linux-sm.gif\n";
} elsif( $sysdescr =~ /(windows|microsoft)/i ) {
$target_lines .= "routers.cgi*Icon: windows-sm.gif\n";
} elsif( $sysdescr =~ /IBM/i ) {
$target_lines .= "routers.cgi*Icon: aix-sm.gif\n";
} elsif( $sysdescr =~ /(sun|solaris)/i ) {
$target_lines .= "routers.cgi*Icon: sun-sm.gif\n";
} elsif( $sysdescr =~ /cisco/i ) {
$target_lines .= "routers.cgi*Icon: cisco-sm.gif\n";
}
$target_lines .= &lt;&lt;ECHO;
routers.cgi*Description: $router_name ($sysname)
routers.cgi*ShortDesc: $sysname
#-------------------------------------------------
ECHO

my($cpuoid) = oid_pick($router_connect,$v3opt,"1.3.6.1.4.1.2021.11.11.0",
"1.3.6.1.4.1.9.2.1.58.0");
if($cpuoid) { # this uses the UCD MIB or Cisco MIB
$target_lines .= &lt;&lt;ECHO;
#######################################
# CPU load
Target[$router_name-cpu]: 100 - $cpuoid&amp;$cpuoid:$router_connect
PageTop[$router_name-cpu]: &lt;H1&gt;$router_name CPU usage&lt;/H1&gt;
Title[$router_name-cpu]: CPU on $router_name
Maxbytes[$router_name-cpu]: 100
Options[$router_name-cpu]: gauge
YLegend[$router_name-cpu]: percent
ShortLegend[$router_name-cpu]: %
LegendI[$router_name-cpu]: cpu:
Legend1[$router_name-cpu]: CPU usage
Legend3[$router_name-cpu]: Peak CPU usage
routers.cgi*Options[$router_name-cpu]: noo, nopercent, nototal, fixunit
routers.cgi*InOut[$router_name-cpu]: no
routers.cgi*ShortDesc[$router_name-cpu]:CPU
routers.cgi*Icon[$router_name-cpu]: chip-sm.gif
routers.cgi*InSummary[$router_name-cpu]: yes
routers.cgi*InCompact[$router_name-cpu]: yes
routers.cgi*Mode[$router_name-cpu]: cpu
routers.cgi*MBLegend[$router_name-cpu]: 100% usage
ECHO
} else { # lets try hrMIB
my (@cpus) = snmpwalk($router_connect,'1.3.6.1.2.1.25.3.3.1.2');
foreach my $tmpcpu (@cpus) {
$tmpcpu =~ /(\d+):\d/;
my( $instance )=$1;
my( $target_name )=$router_name.".cpu".$instance;
$target_lines .= &lt;&lt;ECHO;
Target[$target_name]: 1.3.6.1.2.1.25.3.3.1.2.$instance&amp;1.3.6.1.2.1.25.3.3.1.2.$instance:$router_connect
Title[$target_name]: $sysname processor $instance
MaxBytes[$target_name]: 100
Options[$target_name]: gauge, unknaszero, noo
Directory[$target_name]: $directory_name
WithPeak[$target_name]: wmy
YLegend[$target_name]: % Utilisation
ShortLegend[$target_name]: %
Legend1[$target_name]: 1min CPU load on proc$instance
Legend3[$target_name]: Max 5min CPU load on proc$instance
LegendI[$target_name]: cpu$instance:
PageTop[$target_name]: &lt;H1&gt;$sysname Processor Load&lt;/H1&gt;
routers.cgi*ShortDesc[$target_name]: CPU #$instance
routers.cgi*Options[$target_name]: nopercent, nototal, fixunit
routers.cgi*InOut[$target_name]: no
routers.cgi*Icon[$target_name]: chip-sm.gif
routers.cgi*InSummary[$target_name]: yes
routers.cgi*InCompact[$target_name]: yes
routers.cgi*Mode[$target_name]: cpu
routers.cgi*MBLegend[$target_name]: 100% usage
ECHO
if($#cpus &gt; 0) {
$target_lines .= "routers.cgi*Graph[$target_name]: $router_name-allcpu average\n";
$target_lines .= "routers.cgi*InMenu[$target_name]: no\n";
}
}
if($#cpus &gt; 0) {
$target_lines .= &lt;&lt;ECHO;
routers.cgi*Title[$router_name-allcpu]: All CPUs on $router_name
routers.cgi*Icon[$router_name-allcpu]: chip-sm.gif
routers.cgi*ShortDesc[$router_name-allcpu]: CPU
routers.cgi*LegendAI[$router_name-allcpu]: cpu :
ECHO
}
}

my($rmemoid) = oid_pick($router_connect,$v3opt,"1.3.6.1.4.1.2021.4.6.0");
my($smemoid) = oid_pick($router_connect,$v3opt,"1.3.6.1.4.1.2021.4.4.0");
if($rmemoid and $smemoid) { # this uses the UCD MIB
my($maxreal, $maxswap) = snmpget($router_connect,
"1.3.6.1.4.1.2021.4.5.0","1.3.6.1.4.1.2021.4.3.0");
$target_lines .= &lt;&lt;ECHO;
#######################################
# Memory used
Target[$router_name-memory]: $rmemoid&amp;$smemoid:$router_connect * 1024
PageTop[$router_name-memory]: &lt;H1&gt;$router_name Memory Available &lt;/H1&gt;
Title[$router_name-memory]: Available Memory on $router_name
SetEnv[$router_name-memory]: MRTG_INT_DESCR="Memory"
MaxBytes1[$router_name-memory]: $maxreal
MaxBytes2[$router_name-memory]: $maxswap
Options[$router_name-memory]: gauge
YLegend[$router_name-memory]: Bytes
ShortLegend[$router_name-memory]: b
LegendI[$router_name-memory]: real:
LegendO[$router_name-memory]: swap:
Legend1[$router_name-memory]: Available real memory
Legend2[$router_name-memory]: Available swap space
Legend3[$router_name-memory]: Peak available real
Legend4[$router_name-memory]: Peak available swap
routers.cgi*Options[$router_name-memory]: nototal
routers.cgi*Mode[$router_name-memory]: memory
routers.cgi*ShortDesc[$router_name-memory]: Memory
routers.cgi*Description[$router_name-memory]: Memory available: $router_name
routers.cgi*InOut[$router_name-memory]: no
routers.cgi*InSummary[$router_name-memory]: yes
routers.cgi*InCompact[$router_name-memory]: yes
routers.cgi*Icon[$router_name-memory]: chip-sm.gif
routers.cgi*MBLegend[$router_name-memory]: 100% usage
ECHO
}

my (@storage) = snmpwalk($router_connect,'1.3.6.1.2.1.25.2.3.1.4');
my( $fscnt ) = 0;
foreach my $tmps (@storage) {
$tmps =~ /(\d+):(\d+)/;
next if(!$2);
my($instance,$blocksize)=($1,$2);
my($diskname,$disksize,$disktype) =
snmpget($router_connect,'1.3.6.1.2.1.25.2.3.1.3.'.$instance,
'1.3.6.1.2.1.25.2.3.1.5.'.$instance, '1.3.6.1.2.1.25.2.3.1.2.'.$instance);
$disktype = $1 if($disktype =~ /\.(\d+)$/);
next if(!$diskname or !$disksize
or ($disktype!=2 and $disktype!=3 and $disktype!=4));
my($shortdisk) = $instance;
$shortdisk = $1 if($diskname =~ /^(\w):/);
my($target_name)=$router_name.".disk.".$shortdisk;
my($maxsize)= $disksize * $blocksize;

if($disktype == 2 ) { # memory use
next if($rmemoid); # we already have it
$target_lines .= &lt;&lt;ECHO;
#######################################
# Memory used
Target[$router_name-memory]: 1.3.6.1.2.1.25.2.3.1.6.$instance&amp;1.3.6.1.2.1.25.2.3.1.5.$instance:$router_connect * $blocksize
PageTop[$router_name-memory]: &lt;H1&gt;$router_name Memory Used&lt;/H1&gt;
Title[$router_name-memory]: Memory used on $router_name
SetEnv[$router_name-memory]: MRTG_INT_DESCR="Memory"
MaxBytes[$router_name-memory]: $maxsize
Options[$router_name-memory]: gauge
YLegend[$router_name-memory]: Bytes
ShortLegend[$router_name-memory]: b
LegendI[$router_name-memory]: used:
LegendO[$router_name-memory]: size:
Legend1[$router_name-memory]: Memory used
Legend2[$router_name-memory]: Memory total
Legend3[$router_name-memory]: Peak memory used
Legend4[$router_name-memory]: Peak memory total
routers.cgi*Options[$router_name-memory]: nototal noo
routers.cgi*Mode[$router_name-memory]: memory
routers.cgi*ShortDesc[$router_name-memory]: Memory
routers.cgi*Description[$router_name-memory]: Memory used: $router_name
routers.cgi*InOut[$router_name-memory]: no
routers.cgi*InSummary[$router_name-memory]: yes
routers.cgi*InCompact[$router_name-memory]: yes
routers.cgi*Icon[$router_name-memory]: chip-sm.gif
routers.cgi*MBLegend[$router_name-memory]: 100% usage
ECHO
} elsif($disktype == 3 ) { # swap use
next if($smemoid);
$target_lines .= &lt;&lt;ECHO;
#######################################
# Swap used
Target[$router_name-swap]: 1.3.6.1.2.1.25.2.3.1.6.$instance&amp;1.3.6.1.2.1.25.2.3.1.5.$instance:$router_connect * $blocksize
PageTop[$router_name-swap]: &lt;H1&gt;$router_name Swap space used&lt;/H1&gt;
Title[$router_name-swap]: Swap space used on $router_name
SetEnv[$router_name-swap]: MRTG_INT_DESCR="Swap"
MaxBytes[$router_name-swap]: $maxsize
Options[$router_name-swap]: gauge
YLegend[$router_name-swap]: Bytes
ShortLegend[$router_name-swap]: b
LegendI[$router_name-swap]: used:
LegendO[$router_name-swap]: size:
Legend1[$router_name-swap]: Swap space used
Legend2[$router_name-swap]: Swap space total
Legend3[$router_name-swap]: Peak swap used
Legend4[$router_name-swap]: Peak swap total
routers.cgi*Options[$router_name-swap]: nototal noo
routers.cgi*Mode[$router_name-swap]: memory
routers.cgi*ShortDesc[$router_name-swap]: Swap
routers.cgi*Description[$router_name-swap]: Swap space used: $router_name
routers.cgi*InOut[$router_name-swap]: no
routers.cgi*InSummary[$router_name-swap]: yes
routers.cgi*InCompact[$router_name-swap]: yes
routers.cgi*Icon[$router_name-swap]: chip-sm.gif
routers.cgi*MBLegend[$router_name-swap]: 100% usage
ECHO
} elsif($disktype == 4 ) { # filesystems
$fscnt += 1;
$target_lines .= &lt;&lt;ECHO;
#######################################
# Filesystem $diskname
Target[$target_name]: 1.3.6.1.2.1.25.2.3.1.6.$instance&amp;1.3.6.1.2.1.25.2.3.1.6.$instance:$router_connect * $blocksize
PageTop[$target_name]: &lt;H1&gt;$router_name Disk space used ($diskname)&lt;/H1&gt;
Title[$target_name]: Disk space used on $router_name ($diskname)
SetEnv[$target_name]: MRTG_INT_DESCR="$diskname"
MaxBytes[$target_name]: $maxsize
Options[$target_name]: gauge
YLegend[$target_name]: Bytes
ShortLegend[$target_name]: b
LegendI[$target_name]: used:
Legend1[$target_name]: Space used
Legend3[$target_name]: Peak used
routers.cgi*Options[$target_name]: nototal, noo
routers.cgi*Mode[$target_name]: general
routers.cgi*ShortDesc[$target_name]: Disk: $diskname
routers.cgi*Description[$target_name]: $router_name space used on $diskname
routers.cgi*InOut[$target_name]: no
routers.cgi*InMenu[$target_name]: yes
routers.cgi*InSummary[$target_name]: yes
routers.cgi*InCompact[$target_name]: yes
routers.cgi*Icon[$target_name]: dir-sm.gif
routers.cgi*Graph[$target_name]: $router_name-filesystems "Disk space" withtotal noo
ECHO
}
}
if($fscnt) {
$target_lines .= &lt;&lt;ECHO;
routers.cgi*Options[$router_name-filesystems]: available
routers.cgi*Icon[$router_name-filesystems]: dir-sm.gif
routers.cgi*ShortDesc[$router_name-filesystems]: Filesystems
routers.cgi*Title[$router_name-filesystems]: Filesystems on $router_name
ECHO
}

my($laoid) = oid_pick($router_connect,$v3opt,"1.3.6.1.4.1.2021.10.1.5.2");
my($laoid2) = oid_pick($router_connect,$v3opt,"1.3.6.1.4.1.2021.10.1.5.3");
if($laoid and $laoid2) { # this uses the UCD MIB
$target_lines .= &lt;&lt;ECHO;
#######################################
# Load average
Target[$router_name-lavg]: $laoid&amp;$laoid2:$router_connect / 100
PageTop[$router_name-lavg]: &lt;H1&gt;$router_name Load Average&lt;/H1&gt;
Title[$router_name-lavg]: Load Average on $router_name
SetEnv[$router_name-lavg]: MRTG_INT_DESCR="Load Average"
MaxBytes[$router_name-lavg]: 1000
Options[$router_name-lavg]: nopercent, gauge
YLegend[$router_name-lavg]: Processes
ShortLegend[$router_name-lavg]: &amp;nbsp;
LegendI[$router_name-lavg]: 5min avg:
LegendO[$router_name-lavg]: 15min avg:
Legend1[$router_name-lavg]: 5-min load average
Legend2[$router_name-lavg]: 15-min load average
Legend3[$router_name-lavg]: Peak 5-min load average
Legend4[$router_name-lavg]: Peak 15-min load average
routers.cgi*Options[$router_name-lavg]: nomax, nototal, fixunit, noo
routers.cgi*Mode[$router_name-lavg]: general
routers.cgi*ShortDesc[$router_name-lavg]: Load Avg
routers.cgi*Description[$router_name-lavg]: Load average: $router_name
routers.cgi*UnScaled[$router_name-lavg]: none
routers.cgi*WithPeak[$router_name-lavg]: none
routers.cgi*InOut[$router_name-lavg]: no
routers.cgi*InSummary[$router_name-lavg]: yes
routers.cgi*InCompact[$router_name-lavg]: no
routers.cgi*Icon[$router_name-lavg]: load-sm.gif
ECHO
}

my($ucoid) = oid_pick($router_connect,$v3opt,"1.3.6.1.2.1.25.1.5.0");
if($ucoid) {
$target_lines .= &lt;&lt;ECHO;
#######################################
# User count
Target[$router_name-users]: $ucoid&amp;$ucoid:$router_connect
PageTop[$router_name-users]: &lt;H1&gt;$router_name Active users&lt;/H1&gt;
Title[$router_name-users]: Active Users on $router_name
MaxBytes[$router_name-users]: 1000
SetEnv[$router_name-users]: MRTG_INT_DESCR="Users"
Options[$router_name-users]: nopercent, gauge
YLegend[$router_name-users]: Users
ShortLegend[$router_name-users]: &amp;nbsp;
LegendI[$router_name-users]: Users
Legend1[$router_name-users]: Active Users
Legend3[$router_name-users]: Peak Active Users
routers.cgi*Options[$router_name-users]: nomax, nototal, fixunit, noo
routers.cgi*Mode[$router_name-users]: general
routers.cgi*ShortDesc[$router_name-users]: Users
routers.cgi*Description[$router_name-users]: Users on $router_name
routers.cgi*UnScaled[$router_name-users]: none
routers.cgi*InOut[$router_name-users]: no
routers.cgi*InSummary[$router_name-users]: yes
routers.cgi*InCompact[$router_name-users]: no
routers.cgi*Icon[$router_name-users]: user-sm.gif
ECHO
}

my($proid) = oid_pick($router_connect,$v3opt,"1.3.6.1.2.1.25.1.6.0");
if($proid) {
my($maxpr) = snmpget($router_connect, "1.3.6.1.2.1.25.1.7.0");
$target_lines .= &lt;&lt;ECHO;
#######################################
# Process count
Target[$router_name-procs]: $proid&amp;$proid:$router_connect
PageTop[$router_name-procs]: &lt;H1&gt;$router_name Processes&lt;/H1&gt;
Title[$router_name-procs]: Processes on $router_name
ECHO
if($maxpr) {
$target_lines .= "MaxBytes[$router_name-procs]: $maxpr\n";
} else {
$target_lines .= "MaxBytes[$router_name-procs]: 10000\n";
}
$target_lines .=
"routers.cgi*Options[$router_name-procs]: nototal, fixunit, noo"
.($maxpr?"":", nomax")."\n";
$target_lines .= &lt;&lt;ECHO;
SetEnv[$router_name-procs]: MRTG_INT_DESCR="Procs"
Options[$router_name-procs]: nopercent, gauge
YLegend[$router_name-procs]: Processes
ShortLegend[$router_name-procs]: &amp;nbsp;
LegendI[$router_name-procs]: Procs
Legend1[$router_name-procs]: Processes
Legend3[$router_name-procs]: Peak Processes
routers.cgi*Mode[$router_name-procs]: general
routers.cgi*ShortDesc[$router_name-procs]: Processes
routers.cgi*Description[$router_name-procs]: Processes on $router_name
routers.cgi*UnScaled[$router_name-procs]: none
routers.cgi*InOut[$router_name-procs]: no
routers.cgi*InSummary[$router_name-procs]: yes
routers.cgi*InCompact[$router_name-procs]: no
routers.cgi*Icon[$router_name-procs]: list-sm.gif
routers.cgi*MBLegend[$router_name-procs]: Max capacity
ECHO
}