Perhaps you want to use your own nomenclature, so the device names mean something to you.
You can do it this way:
# emcpadm renamepseudo -s emcpowerh -t emcpowerrh
This renames the device called emcpowerh, to be now called emcpowerrh
106/433
Author: rdircio
Setting a local NTP server and client
You want to synchronize your solaris servers? don’t have access to an atomic clock?
You must pick one of your solaris servers to be the time server, in this case i picked a sun server called “server”. You
will trust in this server’s clock to be correct most of the time.
At “server” do:
root@server# cd /etc/inet
root@server# vi ntp.conf
And paste this inside:
server 127.127.1.0 prefer
fudge 127.127.1.0 stratum 0
broadcast 224.0.1.1 ttl 4
enable auth monitor
driftfile /var/ntp/ntp.drift
statsdir /var/ntp/ntpstats/
filegen peerstats file peerstats type day enable
filegen loopstats file loopstats type day enable
filegen clockstats file clockstats type day enable
keys /etc/inet/ntp.keys
trustedkey 0
requestkey 0
controlkey 0
Then, start ntp:
root@server# /etc/rc2.d/S74xntpd start
Verify its status by checking the process and querying the server:
root@server# ps -ef | grep ntp
root 8339 6236 0 11:39:16 pts/6 0:00 grep ntp
root 6725 1 0 11:15:48 x y z 0:00 /usr/lib/inet/xntpd
root@server# ntpq -pn
remote refid st t when poll reach delay offset disp
==============================================================================
*127.127.1.0 .LCL. 0 l 1 64 377 0.00 0.000 10.01
224.0.1.1 0.0.0.0 16 – – 64 0 0.00 0.000 16000.0
now ON THE CLIENT MACHINE:
root@client# cd /etc/inet
root@client# vi ntp.conf
Paste the contents:
driftfile /var/lib/ntp/ntp.drift
server 150.250.250.18
Notice that 150.250.250.18 is the ip of the timeserver called “server”.
Now nitialize the ntp daemon:
295/433
root@client# /etc/rc2.d/S74xntpd start
Check if it’s running:
root@client # ps -ef | grep ntp
root 23579 1 0 11:20:12 x y z 0:00 /usr/lib/inet/xntpd
root 1054 18332 0 11:41:34 pts/8 0:00 grep ntp
root@client # ntpq -pn
remote refid st t when poll reach delay offset disp
==============================================================================
*150.250.250.18 .LCL. 1 u 4 64 377 18.83 0.473 1.80
That’s it!
now type the “date” command, and see the results!
296/
To re-attach a failed disk on VXVM
vxmend – recover plexes that are in a “DISABLED/RECOVER” state.
vxdiskadm option 1
(/usr/sbin/vxmend)
vxmend -o force off <plex>
vxmend on <plex>
vxmend fix clean <plex>
vxvol start <volume>
fsck the filesystems and mount them
This is Hiram Ruiz’s
219/433
Grow an ext3 Filesystem online
If you want to grow an ext2/ext3 filesystem online and resize2fs can’t do it, use “ext2online”
# ext2online /dev/mapper/my_vg-u10
This will grow the filesystem up to the maximum size the vg allows
thanks to Fergus O’Hea
107/433
Veritas vea java swing window displaying incorrectly in a ssh X11Forwarded session
I connect to a Solaris server using ssh, and turning “ForwardX11 yes” in my ssh client, as well as “X11Forwarding yes”
in my remote solaris server.
The X11 forwarding works fine, because i can exec and view remote solaris dtterms in my slackware machine.
The problem is with java swing apps, like Veritas vea, which, when run, is displayed, but in an incorrectly huge window
size, and with some parts not well redrawn, to the point that it is unusable. Also affected is the WebSphere console…
This is an old bug:
http://bugs.sun. com/bugdatabase/view_bug.do?bug_id=4374153
Everyone basically tells you to set these variables on your shell before executing vea:
NO_AWT_MITSHM=true
NO_J2D_DGA=true
export NO_AWT_MITSHM;export NO_J2D_DGA
But i tried it to no avail. What solved the problem for me was adding a line to my /etc/ssh/ssh_config like this:
ForwardX11Trusted yes
after this everything worked fine!
294/433
Netbackup 5.1 client on Solaris 10
If you push the netbackup client from the master server to a solaris 10 box it thinks it is solaris 8, so it writes entries to
/etc/inetd.conf
Solaris 10 does not have inetd but SMF, so the bpcd port is not activated, you can test by doing a telnet
localhost bpcd… it does not answer.
So you have to convert your /etc/inetd.conf file to SMF descriptors, you do so by running
# inetconv
You make sure it is imported by doing
# inetadm | grep -i bpcd
# telnet localhost bpcd
if you get a connection to the bpcd port you’re all set and you’re ready for backup/restore
🙂
228/433
Message delivery to a dahdi line using the Manager interface with asterisk-java
You want to deliver a message to a pots line, and you don’t trust callprogress in asterisk, so you implement a dialplan
that waits for a digit, then plays a message.
The dialplan, in /etc/asterisk/extensions_custom.conf is
[mimensaje]
exten => s,1(lbl_mensaje_0),Playback(nuevo_mensaje,noanswer)
exten => s,n,WaitForSilence(10,6,10)
exten => s,n,GotoIf($[“${WAITSTATUS}” = “TIMEOUT”]?lbl_mensaje_0:)
exten => s,n,Read(CONTEXT,nuevo_mensaje,1,ni,6,3)
exten => s,n,GotoIf($[“${READSTATUS}” != “OK”]?lbl_mensaje_1:)
exten => s,n,Playback(${elmensaje},noanswer)
exten => s,n,GotoIf($[“${PLAYBACKSTATUS}” = “SUCCESS”]?:lbl_mensaje_2)
exten => s,n(lbl_mensaje_2),Hangup()
exten => s,n(lbl_mensaje_1),Playback(self-destruct,noanswer)
exten => s,n,Goto(lbl_mensaje_2)
The java class that sends the message using that dialplan is:
import java.io.IOException;
import org.asteriskjava.manager.*;
import org.asteriskjava.manager.event.*;
import org.asteriskjava.manager.action. *;
import org.asteriskjava.manager.response.ManagerResponse;
public class HelloEvents1 implements ManagerEventListener
{
private ManagerConnection managerConnection;
String number=””;
String message=””;
int i=0;
public HelloEvents1() throws IOException
{
ManagerConnectionFactory factory = new
ManagerConnectionFactory(“localhost”,”adm”,”password”);
this.managerConnection = factory.createManagerConnection();
}
public OriginateAction setupOriginate(String n,String m) {
OriginateAction originateAction = new OriginateAction();
11/433
originateAction. setChannel(“DAHDI/1/”+n);
originateAction. setVariable(“elmensaje”, m);
originateAction. setContext(“mimensaje”);
originateAction. setExten(“10”);
originateAction. setActionId(n);
originateAction. setAsync(Boolean.TRUE);
originateAction. setTimeout(new Integer(30000));
return originateAction;
}
public void start() throws IOException, AuthenticationFailedException,
TimeoutException, InterruptedException
{
// register for events
managerConnection.addEventListener(this);
// connect to Asterisk and log in
managerConnection.login();
OriginateAction originateAction;
ManagerResponse originateResponse;
originateAction = new OriginateAction();
originateAction=setupOriginate(number,message);
originateResponse = managerConnection.sendAction(originateAction, 30000);
Thread.sleep(20000);
managerConnection.sendAction(new StatusAction()) ;
Thread.sleep(80000);
managerConnection.logoff();
}
public void onManagerEvent(ManagerEvent event)
{
// just print received events
// System.out.println(“——–“+event);
String e=””+event;
if (e.indexOf(“appdata='”+message+”,noanswer'”)>0){
System.out.println(“ISSY: Mensaje recibido<br>”);
System.exit(0);
}
if (e.indexOf(“CONTEXT”)>0||e.indexOf(“nuevo_mensaje”)>0){
i++;
System.out.println(“ISSY: Esperando a que digite 1 : “+i+” de 8 intentos<br>”);
}
if (i==8){
System.out.println(“ISSY: Mensaje no enviado, usuario no digito 1<br>”);
System.exit(1);
}
if (e.indexOf(“HANGUP”)>0){
System.out.println(“ISSY: Linea Colgada, mensaje no enviado<br>”) ;
System.exit(1);
}
}
public static void main(String[] args) throws Exception {
if (args.length<2){
System.out.println(“Usage: Call <number> <message>”);
System.exit(1);
}
12/433
HelloEvents1 hello = new HelloEvents1();
hello.number=args[0];
hello.message=args[1];
hello.start();
}
}
Enjoy!
13/433
Disk contention
To see if we have disk contention problems we’d take a look at an iostat. if asvc_t >50 for sustained periods, the system
has disk contention problems.
[root@ehrpitlin001 ~]# iostat -x 3 10000 | awk '$11>=50' Device: rrqm/s wrqm/s r/s w/s rsec/s wsec/s avgrq-sz avgqu-sz await svctm %util
we can also check if the %wio cpu is > 5% for more than a minute constantly
[root@ehrpitlin001 ~]# vmstat 1 3000 | awk '$16>=5' r b swpd free buff cache si so bi bo in cs us sy id wa st r b swpd free buff cache si so bi bo in cs us sy id wa st r b swpd free buff cache si so bi bo in cs us sy id wa st r b swpd free buff cache si so bi bo in cs us sy id wa st
if we have SAR setup we could check it
[root@ehrpitlin001 ~]# sar | awk '$7>=3{print}' | head -5 12:10:01 AM all 4.93 0.00 2.00 11.84 0.00 81.23 12:20:01 AM all 22.83 0.00 4.96 14.90 0.00 57.31 12:30:01 AM all 37.14 0.00 3.83 11.84 0.00 47.19 12:40:01 AM all 44.26 0.00 3.88 12.71 0.00 39.16 12:50:01 AM all 48.83 0.03 3.57 9.25 0.00 38.32
nfs client entry for vfstab on solaris
somehost:/shared – /mydir nfs – yes rw,soft
Suntrunking Quick setup notes
This is a quick setup guide for suntrunking 1.3
– Install the Suntrunking package. Install the most recent suntrunking patch.
– grab our ce instance numbers, we can get these from path_to_inst.
phoenix# grep ce /etc/path_to_inst
“/sbus@3,0/SUNW, ce@0,8c00000” 0 “ce”
“/sbus@3,0/SUNW, ce@0,8c10000” 1 “ce”
“/sbus@3,0/SUNW, ce@0,8c20000” 2 “ce”
“/sbus@3,0/SUNW, ce@0,8c30000” 3 “ce”
– make sure the local-mac-address? setting is set to true
phoenix# eeprom local-mac-address?
local-mac-address?=false
phoenix# eeprom local-mac-address?=true
In this case we are going to choose ce0 as the head of the trunk, so we set /etc/hostname.ce0 to the hostname and
make sure that
it has an entry in our host file.
There are four possible policies:
1 – MAC Default policy, at its simplest will divide the traffic equally, ie each interface in this example will handle 25% of
the traffic
2 – Round Robin Use each interface in turn
3 – IP Destination Address Use IP Destination address to get the transmission path
4 – IP Source Address/IP Destination Address Deterministic connections
In our case we are going to choose round robin as our policy. So to enable this permanently we edit
/etc/opt/SUNWconn/bin/nettr.sh and add the following line
nettr -setup 0 device=ce policy=2 members=0,1,2,3
We now reboot the server
phoenix# init 6
INIT: New run level: 6
The system is coming down. Please wait.
System services are now being stopped.
Print services already stopped.
Sept 3 09:41:12 phoenix syslogd: going down on signal 15
The system is down.
syncing file systems… done
Program terminated
……………..
Configuring Sun Trunking devices
ce trunk members:
ce0 (head)
ce1
ce2
ce3
configuring IPv4 interfaces: hme0 ce0.
Hostname: phoenix
…….
Now let’s check the configuration
phoenix# ./nettr -conf
Key: 0; Policy: 1;
60/433
Aggr MAC address: 0:14:4f:41:f4:34
Name Original-Mac-Addr Speed Duplex Link Status
—- —————– —– —— —- ——
ce0 0:14:4f:41:f4:34 1000 full up enb
ce1 0:14:4f:41:f4:35 1000 full up enb
ce2 0:14:4f:41:f4:36 1000 full up enb
ce3 0:14:4f:41:f4:37 1000 full up enb
And let’s check the load for each interface, this server is restoring data from tape and sending it to other
servers, so it has mainly outbound traffic. It is very important to push traffic through the trunk in order to see
how is it really operating.
phoenix# ./nettr -stats 0 interval=5
Sep 16 09:16:33 2009
Name Ipkts Ierrs Opkts Oerrs Collis Crc %Ipkts %Opkts
—- —– —– —– —– —— — —— ——
ce0 6 0 26873 0 0 0 0.01 25.01
ce1 6 0 26877 0 0 0 0.01 25.01
ce2 56764 0 26862 0 0 0 99.98 25.00
ce3 0 0 26848 0 0 0 0.00 24.98
(Aggregate Throughput(Mb/sec): 252.00(New Peak) 282.00(Past Peak) 89.36%(N)
61/433