Operating System - HP-UX
1837655 Members
2931 Online
110117 Solutions
New Discussion

Setting up SNMP for MRTG on HP-UX 11.00

 
Alexander Skwar
Frequent Advisor

Setting up SNMP for MRTG on HP-UX 11.00

 
4 REPLIES 4
David_246
Trusted Contributor

Re: Setting up SNMP for MRTG on HP-UX 11.00

Hi Alex,

Indeed this is snmp that is not configured.
snmp should be taken in your /etc/services for registration and you should be able to find a solution when typing "snmp configure" in the search.

Another possibility would be this :

server1:/home/mrtg/cfg 1# cat mrtg_w_server1.cfg
WorkDir: /home/mrtg/html
Target[cpu.server1_w]:`cat /home/mrtg/log/cpu_w_server1.log`
MaxBytes[cpu.server1_w]: 150
Options[cpu.server1_w]: gauge, nopercent
Title[cpu.server1_w]: server1 CPU Usage
PageTop[cpu.server1_w]:

server1 CPU (Waiting for I/O)



WithPeak[cpu.server1_w]: dwm
YLegend[cpu.server1_w]: Percentage Waiting for I/O
LegendI[cpu.server1_w]: WIO
Language: dutch
ShortLegend[cpu.server1_w]: |
LegendO[cpu.server1_w]:

And the script that is run every 5 minutes from cron :

#!/usr/local/bin/perl

use strict;

our @servers=("server1", "server2");
our $mrtg="/usr/local/bin/mrtg";


foreach my $server(@servers) {
my (@user,@system,@wio,@idle,@load);
my $ULOG="/home/mrtg/log/cpu_u_${server}.log";
my $SLOG="/home/mrtg/log/cpu_s_${server}.log";
my $WLOG="/home/mrtg/log/cpu_w_${server}.log";
my $ILOG="/home/mrtg/log/cpu_i_${server}.log";
my $LLOG="/home/mrtg/log/load_${server}.log";

my $UCFG="/home/mrtg/cfg/mrtg_u_${server}.cfg";
my $SCFG="/home/mrtg/cfg/mrtg_s_${server}.cfg";
my $WCFG="/home/mrtg/cfg/mrtg_w_${server}.cfg";
my $ICFG="/home/mrtg/cfg/mrtg_i_${server}.cfg";
my $LCFG="/home/mrtg/cfg/mrtg_l_${server}.cfg";

my $input = `ssh $server "sar -u 2 5 | tail -1"`;
my @input = split( /\s+/, $input);

#my $load = `ssh 1n2 uptime | awk -F, '{print \$4}' | awk -F: '{print \$2}'`;
#my $load = (split /avarage:/, (split /,/, `ssh $server uptime`)[3])[1];
my $load = (split /,/, (split /average:/, `ssh $server uptime`)[1])[0];
$load =~ s/\s+//g;

push(@user, $input[1]);
push(@system, $input[2]);
push(@wio, $input[3]);
push(@idle, $input[4]);
push(@load, $load);
push(@user, 0); push(@user, 0); push(@user, 0);
push(@system, 0); push(@system, 0); push(@system, 0);
push(@wio, 0); push(@wio, 0); push(@wio, 0);
push(@idle, 0); push(@idle, 0); push(@idle, 0);
push(@load, 0); push(@load, 0); push(@load, 0);


open(FHU, "> $ULOG");
open(FHS, "> $SLOG");
open(FHW, "> $WLOG");
open(FHI, "> $ILOG");
open(FHL, "> $LLOG");

foreach my $number(@user) {
print FHU "$number\n";
}

foreach my $number(@system) {
print FHS "$number\n";
}

foreach my $number(@wio) {
print FHW "$number\n";
}

foreach my $number(@idle) {
print FHI "$number\n";
}

foreach my $number(@load) {
print FHL "$number\n";
}

close(FHU);
close(FHS);
close(FHW);
close(FHI);
close(FHL);

`$mrtg $UCFG`;
`$mrtg $SCFG`;
`$mrtg $WCFG`;
`$mrtg $ICFG`;
`$mrtg $LCFG`;
}
@yourservice
Ron Kinner
Honored Contributor

Re: Setting up SNMP for MRTG on HP-UX 11.00

What do you have in
/etc/SnmpAgent.d/snmpd.conf ?

http://docs.hp.com/hpux/onlinedocs/B2355-90681/B2355-90681.html

"Note, the agent does not respond to any SNMP requests, including GetRequests, if no community name is configured in /etc/SnmpAgent.d/snmpd.conf. To configure the agent to respond to GetRequests accompanied by a specific community name, add the community name as a get-community-name to the configuration file. By default the get-community-name is set to public in the file. For details on this configuration file see the snmpd.conf(4) manual page."

You might try modifying the .conf file to add a contact name and see if MRTG picks it up.

I assume a ps shows snmpd is running?

I always crank up my copy of getif on my windows box if I have a problem with mrtg and snmp. I can point it at the target and see what response it gets then use its Mbrowser function to see exactly what response it gets back from a particular MIB and it gives me the OID for each MIB. It's a free tool.

http://www.wtcs.org/snmp4tpc/getif.htm

Ron



Alexander Skwar
Frequent Advisor

Re: Setting up SNMP for MRTG on HP-UX 11.00

Ron,

root_s08nfs:// > grep -v '^#' /etc/SnmpAgent.d/snmpd.conf

set-community-name: public # Write community
trap-dest: 144.250.6.125
trap-dest: 206.120.23.188

Not much...

root_s08nfs:// > ps -ef | grep -i snmp
root 8976 8957 2 10:02:19 pts/5 0:00 grep -i snmp
root 13892 1 0 Jul 18 ? 0:19 /usr/sbin/snmpdm

Nice, I can't use getif :| It doesn't let me enter the hostname "s08nfs.wup.de.delphiauto.com" because it is too long. Entering the IP works, of course. But how do I use the MBrowser? When I select something in the tree on the left, Getif always shows in its status line: "No SNMP Response from 206.122.137.180".


I've now added the following line to /etc/SnmpAgent.d/snmpd.conf:

get-community-name: public
contact: Alexander Skwar

"cfgmaker public@localhost" still returns the error messages I wrote in my original message; the contact name is picked up by mrtg.









David,

root_s08nfs:// > grep snmp /etc/services
snmp 161/udp snmpd # Simple Network Management Protocol Agent
snmp-trap 162/udp trapd # Simple Network Management Protocol Traps

I searched for "snmp configure" on this site but the answers/questions that have been returned didn't seem to help.
Ron Kinner
Honored Contributor

Re: Setting up SNMP for MRTG on HP-UX 11.00

Start getif.

Enter the IP address of the device where it says "Host name" and make sure it says public under SNMP parameters "Read community" then hit Start.

Since MRTG is picking up the contact name it should appear in the box labeled SysContact. IF it doesn't then something is wrong. Perhaps your box needs a route to the network (can you ping it from the window box) or you have mistyped the ip address or the Read community string (it is case sensitive).

Once you get it to talk then you can go to Mbrowser. Click on the + in front of iso then in front of org, dod, internet,mgmt until you find mib2. Click once on it and it should say .iso.org.dod...mib2 at the top. Hit Walk. You should get a list of results at the bottom of the screen. YOu can scroll down through them to see what it learned. IT should show you the different interfaces on the box and also the number of ifInOctets.x and ifOutOctets.x which is what you would expect MRTG to be looking for. x is the interface number as reported by the box.

Hey I just figured out what you did wrong! Try cfgmaker again with out the global max bytes statement. That is not the max bytes per second but the total bytes reported by the ifInOctests or ifOutOctets. You are limiting it to a number smaller than it really is so that causes it report that the number makes no sense.

Ron