January 2007

Sometime you want to automate health-checking of your server. You have created some script that check here and there, and send it to your email. Every morning when you come to office, you just sit there with a cup of coffee while reading email about the status of your server.

Solaris usually already have mail server, the good old sendmail. Sendmail start/stop script available at /etc/init.d/

To start sendmail
/etc/init.d/sendmail start

To stop sendmail
/etc/init.d/sendmail stop

Before you start sendmail, you have to change some configuration first. Uncomment DSmailhost$?m.$m$. at /etc/mail/sendmail.cf. The line should be look like this
# “Smart” relay host (may be null)

Then change your /etc/hosts, add mailhost entry and point it to your office mail relay (MTA).

bash-3.00# more /etc/hosts
# Internet host table
# mailhost

Where is your mail relay.

To test you newly configured sendmail, type this:
/usr/lib/sendmail -v < /dev/null adiguna@gmail.com

You should see something like this if everything went right

#/usr/lib/sendmail -v < /dev/null adiguna@gmail.com
adiguna@gmail.com… Connecting to mailhost.net via relay…
220 JKTGRHXMAV01.x.x.x.x Microsoft ESMTP MAIL Service, Version: 6.0.3790.1830 ready at  Thu, 18 Jan 2007 21:21:34 +0700
>>> EHLO m2000svr.net
250-JKTGRHXMAV01.x.x.x.x Hello [10.x.x.x]
250 OK
>>> MAIL From:<adiguna@m2000svr.net>
250 2.1.0 adiguna@m2000svr.net….Sender OK
>>> RCPT To:<adiguna@gmail.com>
250 2.1.5 adiguna@gmail.com
>>> DATA
354 Start mail input; end with <CRLF>.<CRLF>
>>> .
250 2.6.0  <200701181421.l0IELYn09943@m2000svr.net> Queued mail for delivery
adiguna@gmail.com… Sent ( <200701181421.l0IELYn09943@m2000svr.net> Queued mail for delivery)
Closing connection to mailhost.net
>>> QUIT
221 2.0.0 JKTGRHXMAV01.x.x.x.x Service closing transmission channel

Now you can check your email 🙂

Well sometime you didn’t have XWindows server (dtlogin or citrix) installed in your server. Maybe is a performance things. Because that application suck your server cpu and memory. Hard.

There is workaround to cheat this. You have to export display from your server to your desktop.

1. Use your favorit telnet/ssh session (putty, mstelnet, secure crt) to connect to the server.
2. Open Xserver/Reflection/Xmanager (or other X-Windows Emulator)
3. Export display
tcsh => setenv DISPLAY
ksh/bash => DISPLAY=;export DISPLAY
note: is your desktop IP
4. Execute gui command. For example:
Veritas Enterprise Administrator (vea) -> /opt/VRTS/bin/vea
OSS-RC (ONE) -> /opt/ericsson/bin/nms_one

Sometimes, when you do shell scripting, you have to call another command that need manual input.
For example, you want to send email from the shell

# mail adiguna@domain.com
To: adiguna@domain.com
From: you@domain.com

You need to type manually the three last lines to send email.

You might ask how to handle this without interaction.
That’s when “here” document comes handy.

You can re-write the script like this
# mail adiguna@domain.com << END
From: you@adiguna@domain.com

The syntax for here-document is like this:

command << KEYWORD

I usually use this for mail and Sybase query (isql). For example:

isql -Usa -SSYB -Ppassword -w2000<<-! | egrep -v affected > cgi3.txt
use omcdb
select convert(char(10),c.imap_name) as BSC,
convert(char(25),b.imap_name) as SiteName,
convert(char(25),a.imap_name) as CellName,
convert(char(20),a.imap_CGI) as CGI
from BSCCell a,
BSCBTSSiteManager b,
BSCNE c where a.fdn like b.fdn+’.%’ and a.fdn like c.fdn+’.%’  and b.fdn like c.fdn+’.%’
order by c.imap_name

Or you can also automate your ftp like this :
ftp -in noc4web << end
user anonymous email
prompt off
mput *.*

Have you ever reboot your server from remote (telnet/ssh/cde) and it won’t go up?
And then you must came to freezing server room and connect to server serial port or console (if it have one) to see what went wrong?
If you happen to have this situation and don’t want to get through it again and RSC is a must for you.

RSC can connect to SUN Fire Firmware below OS level (the famous OK Prompt). That not the only RSC capability, RSC can do this:
– Show server environmental status.
– Access a console that includes all UNIX console functions.
– Send a break to put the server into debug mode.
– Control the diagnostics level for a server reboot.
– Reset the server on demand. When the system is not responding, you can issue a cold reset to bring the server back online.

RSC is usually use for Sun Fire Low End Series (V480, V490, V880 & V890), because the Mid-End/High-End already have System Controller for doing such things.

To install RSC, get your Solaris Software Supplement CD and install from RSC_2.2.2 directory. You must install minimum these three packages:
bash-2.03$ pkginfo |grep rsc
system      SUNWrsc        Remote System Control
system      SUNWrscd       Remote System Control User Guide
system      SUNWrscj       Remote System Control GUI

Just do the usual ‘pkgadd -d . <package name>’ at RSC_2.2.2 source directory.

After that, you must configure the RSC. You can use ‘/usr/platform/SUNW,Sun-Fire-880/rsc/rsc-config’. Setup your RSC according to your need. You can activate the Ethernet, Modem or Serial. Usually people activate Ethernet and Serial. This action also setup user for accessing RSC. Then configuration will update to flash and resetting the RSC.

IF you something like this below it means you finally configured RSC on your server.
RSC has been successfully setup

To configure RSC after the setup, for example: add user or change IP, you can use ‘rscadm’ command. Please see my previous post about where you can find ‘rscadm’.

USAGE: rscadm <command> [options]
  For a list of commands, type “rscadm help”

  help, date, set, show, resetrsc, download, send_event, modem_setup,
  useradd, userdel, usershow, userpassword, userperm, shownetwork,
  loghistory, version

  rscadm help => this message
  rscadm date [-s] | [[mmdd]HHMM | mmddHHMM[cc]yy][.SS] => print or set date
  rscadm set <variable> <value> => set variable to value
  rscadm show [variable] => show variable(s)
  rscadm resetrsc [-s] => reset RSC (-s soft reset)
  rscadm download [boot] <file> => program firmware or [boot] monitor
  rscadm send_event [-c] “message” => send message as event (-c CRITICAL)
  rscadm modem_setup => connect to modem port
  rscadm useradd <username> => add RSC user account
  rscadm userdel <username> => delete RSC user account
  rscadm usershow [username] => show user details
  rscadm userpassword <username> => set user password
  rscadm userperm <username> [cuar] => set user permissions
  rscadm shownetwork => show network configuration
  rscadm loghistory => show RSC event log
  rscadm version => show RSC version

Now, get connect the RSC Ethernet port to your LAN/WAN switch, and you won’t have to go to server room anymore.

Sometimes you can’t find where the executable files after you’ve install a package. For example, I’ve just installed rsc (Remote System Controller) for accessing console my Sun Fire server using Serial or IP connection. According to the manual, System Administration command for rsc is rscadm. But when I type rscadm, it failed.

root@m2000svr3G # rscadm
rscadm: not found

And then I check whether the package already installed:

bash-2.03$ pkginfo SUNWrsc
system      SUNWrsc        Remote System Control

I know we can do ‘find’ to find the executable:

root@m2000svr3G # find / -name rscadm

And we can you use the rscadm which suited your system.

But the elegant way is to find at /var/sadm/install/contents file.  For your information, this file is appended every time you install package.

bash-2.03$ grep rscadm /var/sadm/install/contents
/usr/platform/SUNW,Sun-Fire-280R/rsc/rscadm f none 0755 root bin 114028 8640 1071255312 SUNWrsc
/usr/platform/SUNW,Sun-Fire-480R/rsc/rscadm=../../SUNW,Sun-Fire-280R/rsc/rscadm s none SUNWrsc
/usr/platform/SUNW,Sun-Fire-880/rsc/rscadm=../../SUNW,Sun-Fire-280R/rsc/rscadm s none SUNWrsc
/usr/platform/SUNW,Sun-Fire-V490/rsc/rscadm=../../SUNW,Sun-Fire-280R/rsc/rscadm s none SUNWrsc
/usr/platform/SUNW,Sun-Fire-V890/rsc/rscadm=../../SUNW,Sun-Fire-280R/rsc/rscadm s none SUNWrsc
/usr/platform/SUNW,Ultra-250/rsc/rscadm f none 0755 root bin 185388 22971 1071254889 SUNWrsc
/usr/share/man/sman1m/rscadm.sgml f none 0444 root bin 10246 58715 1071255255 SUNWrsc

Bingo! There are your executable files.

Well, after a very long hiatus, I’ve decided to blogging again.Lack of internet access and lack of creativity is one of the reasons why my hiatus took almost two years.

And now, I’m blogging again (with English)

This blog will be focused in everything I’ve interesting to share with you guys. Mainly about my works (System administration of OSS System) and my personal opinion about anything in this world.

See you guys around ^_^ …