LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices



Reply
 
Search this Thread
Old 07-10-2006, 01:58 PM   #1
RaelOM
Member
 
Registered: Dec 2004
Posts: 110

Rep: Reputation: 16
MRTG Custom Scripts Analysis


Hey all, I was hoping everyone could review my scripts and make sure I'm getting these variables the best way and measuring them accurately through the cfg.

Code:
#####################################################################
#
#  Global Configuration Options
#
#####################################################################
EnableIPv6: no
Forks: 2
Logdir: /ford/.u_01/rmussell/mrtg/logs
Imagedir: /ford/.u_01/rmussell/mrtg/logs/images
Htmldir: /ford/.u_01/rmussell/mrtg/eccws531
Timezone[_]: EST
Refresh: 300
######################################################################
#
# System specific configuration
#
######################################################################
#
# System CPU Information
#
Target[cpu.eccws531]: `ssh -xq eccws531.dearborn.ford.com ./cpu.sh`
Options[cpu.eccws531]: gauge,pngdate,growright,nopercent
MaxBytes[cpu.eccws531]: 100
ShortLegend[cpu.eccws531]: %
Unscaled[cpu.eccws531]: ymwd
YLegend[cpu.eccws531]: CPU utilization (user/sys)
Legend1[cpu.eccws531]: User
Legend2[cpu.eccws531]: System
LegendI[cpu.eccws531]:  User: 
LegendO[cpu.eccws531]:  System: 
Directory[cpu.eccws531]: eccws531
Title[cpu.eccws531]: eccws531.dearborn.ford.com -- CPU Utilization
PageTop[cpu.eccws531]: <H1>CPU Utilization -- eccws531.dearborn.ford.com</H1>
#
# System Memory Information
#
Target[mem.eccws531]: `ssh -xq eccws531.dearborn.ford.com ./mem.sh`
Options[mem.eccws531]: gauge,pngdate,growright,nopercent
KMG[mem.eccws531]: k,M,G,T,P,X
MaxBytes[mem.eccws531]:10000000000
Kilo[mem.eccws531]: 1024
YLegend[mem.eccws531]: Memory Availability (Swap/Phy)
Legend1[mem.eccws531]: Swap Available
Legend2[mem.eccws531]: Physical Free
LegendI[mem.eccws531]: &nbsp;Swap Free:&nbsp;
LegendO[mem.eccws531]: &nbsp;Physical Free:&nbsp;
Directory[mem.eccws531]: eccws531
Title[mem.eccws531]: eccws531.dearborn.ford.com -- Memory Utilization
PageTop[mem.eccws531]:<H1>Memory Utilization -- eccws531.dearborn.ford.com</H1>
#
# System Paging Information
#
Target[page.eccws531]: `ssh -xq eccws531.dearborn.ford.com ./page.sh`
Options[page.eccws531]: gauge,pngdate,growright,nopercent
MaxBytes[page.eccws531]:10000000000
KMG[page.eccws531]: k,M,G,T,P,X
Kilo[page.eccws531]: 1024
YLegend[page.eccws531]: Paging Activity (PI/PO)
Legend1[page.eccws531]: Paged IN
Legend2[page.eccws531]: Paged Out
LegendI[page.eccws531]: &nbsp;Paged In:&nbsp;
LegendO[page.eccws531]: &nbsp;Paged Out:&nbsp;
Directory[page.eccws531]: eccws531
Title[page.eccws531]: eccws531.dearborn.ford.com -- Paging Activity
PageTop[page.eccws531]:<H1>Paging Activity -- eccws531.dearborn.ford.com</H1>
#
# System Connections ACTIVE
#
Target[netstat.eccws531]: `ssh -xq eccws531.dearborn.ford.com ./connections.sh`
Options[netstat.eccws531]: gauge,pngdate,growright,nopercent,perminute,integer
MaxBytes[netstat.eccws531]: 10000
ShortLegend[netstat.eccws531]: c/s
YLegend[netstat.eccws531]: TCP Connections
Legend1[netstat.eccws531]: ESTABLISHED Connections
Legend2[netstat.eccws531]: TIME_WAIT Connections
LegendI[netstat.eccws531]: &nbsp;ESTABLISHED:&nbsp;
LegendO[netstat.eccws531]: &nbsp;TIME_WAIT:&nbsp;
Directory[netstat.eccws531]: eccws531
Title[netstat.eccws531]: eccws531.dearborn.ford.com -- Active TCP Connections
PageTop[netstat.eccws531]: <H1>Active TCP Connections -- eccws531.dearborn.ford.com</H1>
#
# System Connections FINWAIT
#
Target[netstat1.eccws531]: `ssh -xq eccws531.dearborn.ford.com ./connections1.sh`
Options[netstat1.eccws531]: gauge,pngdate,growright,nopercent,perminute,integer
MaxBytes[netstat1.eccws531]: 10000
ShortLegend[netstat1.eccws531]: c/s
YLegend[netstat1.eccws531]: TCP Connections
Legend1[netstat1.eccws531]: FIN_WAIT_2 Connections
Legend2[netstat1.eccws531]: &nbsp;
LegendI[netstat1.eccws531]: &nbsp;ESTABLISHED:&nbsp;
LegendO[netstat1.eccws531]: &nbsp;
Directory[netstat1.eccws531]: eccws531
Title[netstat1.eccws531]: eccws531.dearborn.ford.com -- Active FIN_WAIT_2 Connections
PageTop[netstat1.eccws531]: <H1>Active FIN_WAIT_2 Connections -- eccws531.dearborn.ford.com</H1>
#
# WebServers Active
#
Target[web.eccws531]: `ssh -xq eccws531.dearborn.ford.com ./web.sh`
Options[web.eccws531]: gauge,pngdate,growright,nopercent,integer
MaxBytes[web.eccws531]: 300
ShortLegend[web.eccws531]: &nbsp;
YLegend[web.eccws531]: WebServers
Legend1[web.eccws531]: Configured Web Servers
Legend2[web.eccws531]: Active Web Servers
LegendI[web.eccws531]: &nbsp;Configured:&nbsp;
LegendO[web.eccws531]: &nbsp;Active:&nbsp;
Directory[web.eccws531]: eccws531
Title[web.eccws531]: eccws531.dearborn.ford.com -- WebServers Configured/Active
PageTop[web.eccws531]: <H1>WebServers Configured/Active -- eccws531.dearborn.ford.com</H1>
#
# Connected Users
#
Target[users.eccws531]: `ssh -xq eccws531.dearborn.ford.com ./users.sh`
Options[users.eccws531]: gauge,pngdate,growright,nopercent,integer
MaxBytes[users.eccws531]: 100000
Shortlegend[users.eccws531]: &nbsp;
YLegend[users.eccws531]: Users (who)
Legend1[users.eccws531]: Users Logged On
Legend2[users.eccws531]: &nbsp;
LegendI[users.eccws531]: &nbsp;Logged On:&nbsp;
LegendO[users.eccws531]: &nbsp;
Directory[users.eccws531]: eccws531
Title[users.eccws531]: eccws531.dearborn.ford.com -- Users Logged onto the system
PageTop[users.eccws531]: <H1>Users Logged onto the system -- eccws531.dearborn.ford.com</H1>
#
# Number of Processes on the Host
#
Target[numproc.eccws531]: `ssh -xq eccws531.dearborn.ford.com ./numproc.sh`
Options[numproc.eccws531]: gauge,pngdate,growright,nopercent,integer
MaxBytes[numproc.eccws531]: 1000000
Shortlegend[numproc.eccws531]: &nbsp;
YLegend[numproc.eccws531]: Processes
Legend1[numproc.eccws531]: Processes
Legend2[numproc.eccws531]: &nbsp;
LegendI[numproc.eccws531]: &nbsp;Processes:&nbsp;
LegendO[numproc.eccws531]: &nbsp;
Directory[numproc.eccws531]: eccws531
Title[numproc.eccws531]: eccws531.dearborn.ford.com -- Number of Processes on the Host
PageTop[numproc.eccws531]: <H1>Number of Processes on the Host -- eccws531.dearborn.ford.com</H1>
#
# Processes in Run Queue / Blocked Queue
#
Target[proc.eccws531]: `ssh -xq eccws531.dearborn.ford.com ./proc.sh`
Options[proc.eccws531]: gauge,pngdate,growright,nopercent,integer
MaxBytes[proc.eccws531]: 10000000
Shortlegend[proc.eccws531]: &nbsp;
YLegend[proc.eccws531]: Run Queue
Legend1[proc.eccws531]: Processes Running
Legend2[proc.eccws531]: Processes Blocked
LegendI[proc.eccws531]: &nbsp;Running:&nbsp;
LegendO[proc.eccws531]: &nbsp;Blocked:&nbsp;
Directory[proc.eccws531]: eccws531
Title[proc.eccws531]: eccws531.dearborn.ford.com -- Processes in the Run Queue / Blocked Queue
PageTop[proc.eccws531]: <H1>Processes in the Run Queue / Blocked Queue -- eccws531.dearborn.ford.com</H1>
#
# Interface Traffic for eth0
#
Target[eth0.eccws531]: `ssh -xq eccws531.dearborn.ford.com ./traf1.sh`
Options[eth0.eccws531]: gauge,pngdate,growright,nopercent,bits
MaxBytes[eth0.eccws531]: 125000000
KMG[eth0.eccws531]:M
Kilo[eth0.eccws531]: 1024
YLegend[eth0.eccws531]: eth0 Traffic
Legend1[eth0.eccws531]: eth0/IN
Legend2[eth0.eccws531]: eth0/OUT
LegendI[eth0.eccws531]: &nbsp;Bytes IN:&nbsp;
LegendO[eth0.eccws531]: &nbsp;Bytes OUT:&nbsp;
Directory[eth0.eccws531]: eccws531
Title[eth0.eccws531]: eccws531.dearborn.ford.com -- Interface Traffic for HME0
PageTop[eth0.eccws531]: <H1>Interface Traffic for eth0 -- eccws531.dearborn.ford.com</H1>
Here are the scripts associated with it.

Code:
#!/bin/sh
# cpu.sh

vmstat 1 2 | tail -1 >> /tmp/vmstat.mrtg
cat /tmp/vmstat.mrtg | awk '{print $13}'
cat /tmp/vmstat.mrtg | awk '{print $14}'
uptime | awk '{print $3 " " $4; }' | cut -f1 -d","
hostname
rm /tmp/vmstat.mrtg
Code:
#!/bin/sh
# mem.sh

MFREE=`free | grep Mem | awk '{print $4}'`
MBUFF=`free | grep Mem | awk '{print $6}'`
MCACH=`free | grep Mem | awk '{print $7}'`
MTOTA=`free | grep Mem | awk '{print $2}'`

let RESULT1=$MFREE+$MBUFF+$MCACH

free | grep Swap | awk '{print $4}'
echo $RESULT1
uptime | awk '{print $3 " " $4; }' | cut -f1 -d","
hostname
Code:
#!/bin/sh
# page.sh

vmstat 1 2 | tail -1 >> /tmp/vmstat.mrtg2
cat /tmp/vmstat.mrtg2 | awk '{print $7}'
cat /tmp/vmstat.mrtg2 | awk '{print $8}'
uptime | awk '{print $3 " " $4; }' | cut -f1 -d","
hostname
rm /tmp/vmstat.mrtg2
Code:
#!/bin/sh
# connections.sh

netstat -a | grep ESTABLISHED | wc -l | awk '{print $1}' 2>/dev/null >> /tmp/net
stat.mrtg
netstat -a | grep TIME_WAIT | wc -l | awk '{print $1}' 2>/dev/null >> /tmp/netst
at.mrtg
cat /tmp/netstat.mrtg
uptime | awk '{print $3 " " $4; }' | cut -f1 -d","
hostname
rm /tmp/netstat.mrtg
Code:
#!/bin/sh
# connections1.sh
netstat -a | grep FIN_WAIT_2 | wc -l | awk '{print $1}' 2>/dev/null >> /tmp/nets
tat.mrtg
cat /tmp/netstat.mrtg
echo 0
uptime | awk '{print $3 " " $4; }' | cut -f1 -d","
hostname
rm /tmp/netstat.mrtg
Code:
#!/bin/sh
# traf1.sh

sar -n DEV -f /var/log/sa/sa.`date +%G_%m_%d` | grep eth0 | grep -v Average | ta
il -1 | awk '{print $5}'
sar -n DEV -f /var/log/sa/sa.`date +%G_%m_%d` | grep eth0 | grep -v Average | ta
il -1 | awk '{print $6}'
uptime | awk '{print $3 " " $4; }' | cut -f1 -d","
hostname
Code:
#!/bin/sh
# numproc.sh

ps -e | grep -v PID | wc -l | awk '{print $1}'
echo 0
uptime | awk '{print $3 " " $4; }' | cut -f1 -d","
hostname
Code:
#!/bin/sh
# proc.sh
# Number of proc's in the r/b queue

vmstat 1 2 | tail -1 >> /tmp/vmstat.mrtg3
cat /tmp/vmstat.mrtg3 | awk '{print $1}'
cat /tmp/vmstat.mrtg3 | awk '{print $2}'
uptime | awk '{print $3 " " $4; }' | cut -f1 -d","
hostname
rm /tmp/vmstat.mrtg3
Code:
#!/bin/sh
# users.sh

w | grep -v USER | grep -v up | wc -l >> /tmp/w.mrtg
cat /tmp/w.mrtg | awk '{print $1}'
echo 0
uptime | awk '{print $3 " " $4; }' | cut -f1 -d","
hostname
rm /tmp/w.mrtg
 
Old 07-11-2006, 10:38 AM   #2
RaelOM
Member
 
Registered: Dec 2004
Posts: 110

Original Poster
Rep: Reputation: 16
No comments or anything ehh?
 
Old 07-11-2006, 11:13 AM   #3
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,718
Blog Entries: 54

Rep: Reputation: 2967Reputation: 2967Reputation: 2967Reputation: 2967Reputation: 2967Reputation: 2967Reputation: 2967Reputation: 2967Reputation: 2967Reputation: 2967Reputation: 2967
Come on, you posted this a day ago...
Give people some time to react, OK?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Java static analysis and custom bug detectors LXer Syndicated Linux News 0 07-04-2006 12:12 AM
Custom scripts Minnie000 Linspire/Freespire 1 04-24-2005 04:30 PM
custom geforce video card--custom module? bandofmercy Linux - Hardware 3 10-14-2004 07:52 PM
MRTG getting output from scripts ivanatora Linux - Software 1 08-12-2004 06:23 AM
rrd mrtg & mrtg-rrd.cgi ducati620 Linux - Newbie 0 06-03-2004 08:29 PM


All times are GMT -5. The time now is 10:06 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration