Extended system stats graphing- vmstat, iostat, mpstat (sar)

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

black
Posts: 5
Joined: Tue Jul 01, 2008 1:54 am

Post by black »

Hello, this template is really great!

Have you any update on these features?

Average Queue Size
Average Request size (in blocks)
Average Wait time
Average Service time
Read/Write kB
Read/Write sectors
Read/Write Operations
Read/Write requests merged
CPU Utilisation for read/write

I'd like to have swap-in / swap-out too - about the metrics above I think that the most important is the first.

Thank you!
elpiako
Cacti User
Posts: 85
Joined: Tue Jul 01, 2008 10:02 am
Location: Lille (FRANCE)

Post by elpiako »

I've got a problem with the Sarparse scripts, it doesn't work on one of my servers and I have no data on graphs for Server2.

On Server1 (see my sign for infos), it works fine.
On Server2 it doesn't. I've checked what I thought good to check and I've found somethg :

On Server2, when I launch the command /usr/lib/nagios/plugins/check_nrpe -H myremotehost.domain.com -c sar, it returns CHECK_NRPE: Socket timeout after 10 seconds.
On Server1, there's no problem, it returns a lot of things about CPU, processes, etc.

After some researches, i've found that I should test /usr/lib/nagios/plugins/check_nrpe -H localhost, and it returns Connection refused by host, BUT Server1 returns the same thing (and check_nrpe works fine, remember)... so... what's going on... :(

May someone help me please ?
Server1
Cacti : 0.8.7h | Architecture : 3.0
autom8 : 0.35 | aggregate : 0.75 | settings : 0.71 | thold : 0.4.7 | weathermap : 0.97a

Server2
Cacti : 0.8.7g | Architecture : 2.8
autom8 : 0.35 | aggregate : 0.75 | settings : 0.7 | thold : 0.4.3 | weathermap : 0.97a | flowview : 0.6
Adelie
Posts: 7
Joined: Thu Jun 19, 2008 12:45 pm
Location: http://www.alternatepropulsion.com

Post by Adelie »

I would start by seeing if the nrpe agent on server 2 is up and running.

First, have you tried telnetting to the port (I am assuming you are using the default 5666)?

Code: Select all

 $ telnet server2 5666
If you get a connection, then you know that the nrpe agent is up and running.

also, on server2 you could turn on debugging in your nrpe.cfg by setting debug=1 and then watching syslog for any goofy messages.
elpiako
Cacti User
Posts: 85
Joined: Tue Jul 01, 2008 10:02 am
Location: Lille (FRANCE)

Post by elpiako »

telnet server2 5666 doesn't work on server1, nor on server2 (but keep in mind that check_nrpe works on server1 !! )

and I have no nrpe.cfg :x
I just have a check_nrpe.cfg where I have this :

# this command runs a program $ARG1$ with arguments $ARG2$
define command {
command_name check_nrpe
command_line /usr/lib/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -c $
}

# this command runs a program $ARG1$ with no arguments
define command {
command_name check_nrpe_1arg
command_line /usr/lib/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -c $
}


If you meant this file, where do I add "debug=1" ??
Server1
Cacti : 0.8.7h | Architecture : 3.0
autom8 : 0.35 | aggregate : 0.75 | settings : 0.71 | thold : 0.4.7 | weathermap : 0.97a

Server2
Cacti : 0.8.7g | Architecture : 2.8
autom8 : 0.35 | aggregate : 0.75 | settings : 0.7 | thold : 0.4.3 | weathermap : 0.97a | flowview : 0.6
elpiako
Cacti User
Posts: 85
Joined: Tue Jul 01, 2008 10:02 am
Location: Lille (FRANCE)

Post by elpiako »

ok, where can I find an howto for install/use sarparse ??

And i've found the nrpe.cfg on my target host, set the debug=1, then checked the syslog.

I found all good messages when I'm trying to check_nrpe from Server1, but absolutely NO messages when I'm trying from Server2...

wtf :(
Server1
Cacti : 0.8.7h | Architecture : 3.0
autom8 : 0.35 | aggregate : 0.75 | settings : 0.71 | thold : 0.4.7 | weathermap : 0.97a

Server2
Cacti : 0.8.7g | Architecture : 2.8
autom8 : 0.35 | aggregate : 0.75 | settings : 0.7 | thold : 0.4.3 | weathermap : 0.97a | flowview : 0.6
elpiako
Cacti User
Posts: 85
Joined: Tue Jul 01, 2008 10:02 am
Location: Lille (FRANCE)

Post by elpiako »

Something new !

I said "telnet Server2 5666" and "telnet Server1 5666" didn't work from any target-host.

BUT: "telnet target-host 5666" works from Server1 and doesn't work from Server2 !

Should it be the problem ?
HELP please !!
Server1
Cacti : 0.8.7h | Architecture : 3.0
autom8 : 0.35 | aggregate : 0.75 | settings : 0.71 | thold : 0.4.7 | weathermap : 0.97a

Server2
Cacti : 0.8.7g | Architecture : 2.8
autom8 : 0.35 | aggregate : 0.75 | settings : 0.7 | thold : 0.4.3 | weathermap : 0.97a | flowview : 0.6
it
Cacti User
Posts: 118
Joined: Tue Jun 17, 2008 12:44 pm

Post by it »

is sarparse.pl working? i was working on it? it doesn t give me the output the way it should be .


it s giving me : Use of uninitialized value in concatenation (.) or string at ./sarparse.pl line 57.
procs: [cacti@servername scripts]

so the script is not executing the if i==1 loop so no vals

any ideas
???

thx
Last edited by it on Tue Jul 29, 2008 8:45 am, edited 1 time in total.
elpiako
Cacti User
Posts: 85
Joined: Tue Jul 01, 2008 10:02 am
Location: Lille (FRANCE)

Post by elpiako »

elpiako wrote:Something new !

I said "telnet Server2 5666" and "telnet Server1 5666" didn't work from any target-host.

BUT: "telnet target-host 5666" works from Server1 and doesn't work from Server2 !

Should it be the problem ?
HELP please !!
I solved my problem. The firewall of the datacenter didn't allow tcp packets on port 5666 from my Server2 to any host, and it does for Server1, that's why it worked for Server1 :P
Server1
Cacti : 0.8.7h | Architecture : 3.0
autom8 : 0.35 | aggregate : 0.75 | settings : 0.71 | thold : 0.4.7 | weathermap : 0.97a

Server2
Cacti : 0.8.7g | Architecture : 2.8
autom8 : 0.35 | aggregate : 0.75 | settings : 0.7 | thold : 0.4.3 | weathermap : 0.97a | flowview : 0.6
it
Cacti User
Posts: 118
Joined: Tue Jun 17, 2008 12:44 pm

Post by it »

what about sarparse , is it working ??

what r u having as output:??? when u run it in the command line??

because all my graphs are empty

thx
elpiako
Cacti User
Posts: 85
Joined: Tue Jul 01, 2008 10:02 am
Location: Lille (FRANCE)

Post by elpiako »

You must have this output :

host:/home/cacti/scripts# perl sarparse.pl host2.domain.com
procs:0 cswchs:17103096 CPU:0 user:2049 nice:0 system:18070 iowait:0 steal:0 idle:78080 pgpgins:0 pgpgouts:3120079 faults:68032 majflts:0 kbmemfree:130640 kbmemused:1946096 memused:93071 kbbuffers:142436 kbcached:1023068 kbswpfree:3743032 kbswpused:72 swpused:0 kbswpcad:0 dentunusd:2073271 file_sz:10560 inode_sz:43337 super_sz:0 super_sz:0 dquot_sz:0 dquot_sz:0 rtsig_sz:0 rtsig_sz:0 totsck:1576 tcpsck:73 udpsck:13 rawsck:0 ip_frag:0 runq_sz:2 plist_sz:505 ldavg_1:8013 ldavg_5:8074 ldavg_15:8013
host:/home/cacti/scripts#


and sarparse.pl makes check_nrpe -H $ip -c sar where check_nrpe is a command located according to the $nagios_plugin_path value (for me : /usr/lib/nagios/plugins).
Server1
Cacti : 0.8.7h | Architecture : 3.0
autom8 : 0.35 | aggregate : 0.75 | settings : 0.71 | thold : 0.4.7 | weathermap : 0.97a

Server2
Cacti : 0.8.7g | Architecture : 2.8
autom8 : 0.35 | aggregate : 0.75 | settings : 0.7 | thold : 0.4.3 | weathermap : 0.97a | flowview : 0.6
it
Cacti User
Posts: 118
Joined: Tue Jun 17, 2008 12:44 pm

Post by it »

can you past for me ur sarparse script code. because i am only getting the first line.
i am getting this output :


Use of uninitialized value in concatenation (.) or string at ./sarparse.pl line 57.
procs: [cacti@servername scripts]

thx for ur help and response
elpiako
Cacti User
Posts: 85
Joined: Tue Jul 01, 2008 10:02 am
Location: Lille (FRANCE)

Post by elpiako »

host:/home/cacti/scripts# cat sarparse.pl
#!/usr/bin/perl -w

no warnings ;

use Math::Round qw(:all);

#######################################################3
#
# f: sarparse.pl v.01
# a: adam backer
# e: backcountry.com
#
# summary:
# fetches some sar data via nrpe, parses it and produces cacti-friendly output
#
# command[sar]=sar -Brcquwv -n SOCK 1 1|grep Average
#

$ip=$ARGV[0];
$nagios_plugin_path="/usr/lib/nagios/plugins";


if (!$ip){ # !~ /\d+/) {
print "Usage: sarparse.pl <ip>\n";
exit 3;
}
else {
@input=`$nagios_plugin_path/check_nrpe -H $ip -c sar`;
$i=0;
$f=0;
$v=0;
foreach $line (@input) {
@line = split(' ', $line);
$fc=$#line;
for ($x=1; $x<=$fc; $x++) {
if ($x == $fc) { $end = 1; } else { $end = 0; }
if ($i == 0) {
$line[$x]=~s/\///;
$line[$x]=~s/\%//;
$line[$x]=~s/-/_/;
$fields[$f]=$line[$x];
#print "settings fields $f to $line[$x] - ";
$f++;
if ($end) {
$i=1;
}
next;
}
if ($i == 1) {
$vals[$v]= round(atoi($line[$x]));
#print "setting vals $v to $line[$x]\n";
$v++;
if ($end) {
$i=0;
}
next;
}
}
}
$output='';
for ($x=0; $x<=$#fields; $x++) {
$output=$output."$fields[$x]:$vals[$x] ";
}
print $output;
}


sub atoi {
my $t;
foreach my $d (split(//, shift())) {
$t = $t * 10 + $d;
}
return $t;
}
Server1
Cacti : 0.8.7h | Architecture : 3.0
autom8 : 0.35 | aggregate : 0.75 | settings : 0.71 | thold : 0.4.7 | weathermap : 0.97a

Server2
Cacti : 0.8.7g | Architecture : 2.8
autom8 : 0.35 | aggregate : 0.75 | settings : 0.7 | thold : 0.4.3 | weathermap : 0.97a | flowview : 0.6
it
Cacti User
Posts: 118
Joined: Tue Jun 17, 2008 12:44 pm

Post by it »

mine is different:


#!/usr/bin/perl -w

#######################################################3
#
# f: sarparse.pl v.01
# a: adam backer
# e: backcountry.com
#
# summary:
# fetches some sar data via nrpe, parses it and produces cacti-friendly output
#
# command[sar]=sar -Brcquwv -n SOCK 1 1|grep Average
#

$ip=$ARGV[0];
$nagios_plugin_path="/usr/local/nagios/libexec/";


if (!$ip){ # !~ /\d+/) {
print "Usage: sarparse.pl <ip>\n";
exit 3;
}
else {
@input=`$nagios_plugin_path/check_nrpe -H $ip -c sar`;
$i=0;
$f=0;
$v=0;
foreach $line (@input) {
@line = split(' ', $line);
$fc=$#line;
for ($x=1; $x<=$fc; $x++) {
if ($x == $fc) { $end = 1; } else { $end = 0; }
if ($i == 0) {
$line[$x]=~s/\///;
$line[$x]=~s/\%//;
$line[$x]=~s/-/_/;
$fields[$f]=$line[$x];
#print "settings fields $f to $line[$x] - ";
$f++;
if ($end) {
$i=1;
}
next;
}
if ($i == 1) {
$vals[$v]=$line[$x];
#print "setting vals $v to $line[$x]\n";
$v++;
if ($end) {
$i=0;
}
next;
}
}
}
$output='';
for ($x=0; $x<=$#fields; $x++) {
$output=$output."$fields[$x]:$vals[$x] ";
}
print $output;
}


so am gona try ur code?? from where did u download it??
it
Cacti User
Posts: 118
Joined: Tue Jun 17, 2008 12:44 pm

Post by it »

still have no luck, did u go through the problem am having right now ,
????
elpiako
Cacti User
Posts: 85
Joined: Tue Jul 01, 2008 10:02 am
Location: Lille (FRANCE)

Post by elpiako »

yep. And i've explained what was my problem just before (on my firewall : allow my Server2 to query any host on port 5666). I thought I had no problem with that but I was wrong :)

and make sure you have made this on you target host (it's an extract from my own procedure to install sar so tell me if you got some probs to translate french :P ) :

1. Apt-get install sysstat nagios-nrpe-server
2. Vi /etc/default/sysstat (et changer la valeur de la variable « ENABLED » par « TRUE »).
3. Configurer nrpe.cfg (/etc/nagios/nrpe.cfg /etc/nagios/nrpe.cfg)
4. Taper « /etc/init.d/nagios-nrpe-server restart ». Il faut absolument que les lignes suivantes s’affichent :
Stopping nagios-nrpe: nagios-nrpe.
Starting nagios-nrpe: nagios-nrpe.

Pour vérifier que le processus « nrpe » se soit bien exécuté, aller dans /etc/nagios/nrpe.cfg, mettre la variable debug égale à 1, puis taper « cat /var/log/syslog | grep nrpe ». Les 4 dernières lignes doivent ressembler à :
Jul 21 16:29:40 localhost nrpe[12375]: Added command[check_procs]=/usr/lib/nagios/plugins/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$
Jul 21 16:29:40 localhost nrpe[12375]: INFO: SSL/TLS initialized. All network traffic will be encrypted.
Jul 21 16:30:55 localhost nrpe[12641]: Starting up daemon
Jul 21 16:30:55 localhost nrpe[12641]: Listening for connections on port 5666

Si la ligne suivante s’affiche :

Jul 21 16:29:40 localhost nrpe[12376]: There's already an NRPE server running (PID 21968). Bailing out...

Killer le processus, retaper « /etc/init.d/nagios-nrpe-server restart », et revérifier dans syslog que les 4 dernières lignes soient correctes (cf ci-dessus).
5. Redémarrer le daemon sar : /etc/init.d/sysstat restart

edit : btw, "Killer" means "Kill", it's what we call frenglish :P
Last edited by elpiako on Tue Jul 29, 2008 10:11 am, edited 1 time in total.
Server1
Cacti : 0.8.7h | Architecture : 3.0
autom8 : 0.35 | aggregate : 0.75 | settings : 0.71 | thold : 0.4.7 | weathermap : 0.97a

Server2
Cacti : 0.8.7g | Architecture : 2.8
autom8 : 0.35 | aggregate : 0.75 | settings : 0.7 | thold : 0.4.3 | weathermap : 0.97a | flowview : 0.6
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests