90 Posts

August 29th, 2008 07:00

Here is a small one I wrote to make a backup of the custom items and files we have in nasadmin's homedir, and also the nasdb. This copies the backup tar to a filesysem that is backed up. This saved us once, when our nasdb got corrupted and we didn't notice till after the local backups were all corrupted too.

The top part is key, you need to set the variables to run as cron, since you will not be logged in have them set via login. The little if statement just checks to make sure you are on the primary control station, if not exit. If you run anything from outside source (linux server), then you need to declare the variables in each SSH command you issue. I have examples of that if you need. Hope this helps

#!/bin/bash

PATH=$PATH:$HOME/bin:/nas/sbin
export PATH
NAS_DB=/nas
export NAS_DB
MANPATH=/usr/share/man:/usr/man:$NAS_DB/man
export MANPATH
PATH=$PATH:$NAS_DB/bin
export PATH
SLOT=`/nasmcd/sbin/t2slot`
CS=`/nasmcd/sbin/getreason -s $SLOT`
if [ $CS -eq 11 ]
then
exit 1
fi
tar -cpf /nas/quota/slot_5/data1/backup/backup.tar /home/nasadmin/nasdb_backup.1.tar.gz /home/nasadmin/bin/* /home/nasadmin/quota/* /home/nasadmin/config/* /home/nasadmin/virus_conf_files/*
exit 1

9 Legend

 • 

20.4K Posts

August 28th, 2008 09:00

any websites that explains how to script in bash/korn shell will be a good starting point.

90 Posts

August 28th, 2008 18:00

I suggest learning sa much as possible about shell scripting on linux and possibly perl and also CLI functions on the celerra. Then you can put the two together and create shells scripts to do lots of things. I have a lot of scripted monitoring and alerting setup in my environment. I would be happy to assist with specific tasks if you need.

28 Posts

August 29th, 2008 01:00

Hey guys thanks for the answers.. I will pick up some korn bash scripting books off amazon..

Sagle.. would you be able to post just one of your scripts? It doesnt really matter what it does but just so I can see the syntax and the CLI commands together would be great. Just to give me an idea... As I said above my first script will be using nas_replicate to failover a vdm and its filesystems..

Thanks!

Packetboy.

4 Operator

 • 

8.6K Posts

August 29th, 2008 06:00

Hi,

could start taking a look at one of the EMC skripts like /nas/sbin/refresh_ckpt

Its probably a bit longer and more verbose than what you would write, but it shows the concepts.
It also shows how to use -query argument to get specific fields from the output of a Celerra command

Another neat trick to find out the exact syntax and args for something you want to do is to do it with
the Celerra Manager GUI and then do
tail /nas/log/cmd_log
This will show you what the GUI actually issued

9 Legend

 • 

20.4K Posts

August 29th, 2008 07:00

oh that's pretty slick ..thanks for sharing.

45 Posts

August 29th, 2008 07:00

on some nas binary, you have a query langage

example (report of checkpoint space) :

nas_fs -query:* -format:'%q' -Fields:checkpoints -query:* -format:'%s;%s\n' -fields:name,SizeValues | sort | sed 's/,/;/g' | awk -F ';' '{printf"%s: Size=
%6d, Available= %6d, Used= %6d (%3d%) (Size in MB)\n",$1,$2,$3,$4,$5}'

All is explain in celerra documentation

++

4 Operator

 • 

8.6K Posts

August 29th, 2008 09:00

see attached appendix from the Command Reference Manual

1 Attachment

28 Posts

September 4th, 2008 01:00

Thanks to everyone for the very helpful comments.. I have ordered a few bash scripting books from amazon and started checking out the query command on the nas binaries.. Its just a pity it doesnt seem the query command works on nas_replicate but that gives me the excuse to just bash script that one..


Will let everyone know how the script turns out..

Thanks again to everyone for being so helpful on this forum!

4 Operator

 • 

8.6K Posts

September 4th, 2008 11:00

Has anyone looked at accessing the celerra stats by directly using the java databases in /nas/jserver/sdb/ ?


I wouldnt do that - these are subject to change at any time

If you need performance data take a look at the (new in DART 5.6) server_stats command

If there is something missing there we would like to get feedback

76 Posts

September 4th, 2008 11:00

Hi;,
Has anyone looked at accessing the celerra stats by directly using the java databases in /nas/jserver/sdb/ ?
Parsing the output of some of these utilities can be tricky.

Scot

76 Posts

September 4th, 2008 12:00

But that's the point. I am looking for stats not to hold open but just to expose what we see in Celerra manager without having to use server_stats commands every 2-5 minutes. I have found the stats difficult to parse and some show inconsistent results with celerra manager and even missing data points on some cycles. To me it would be infinatly better to take that load off the control station and directly poll the db files for the last value.
The goal is to expose the stats over SNMP from the control station like so...
exec .1.3.6.1.4.1.2021.50.#.#.#.# sysstat /home/nasadmin/snmp/server_snmp.sh server_3 sysstat
exec .1.3.6.1.4.1.2021.50.#.#.#.#. nfsstat /home/nasadmin/snmp/server_snmp.sh server_3 nfsstat
exec .1.3.6.1.4.1.2021.50.#.#.#.# cifsstat /home/nasadmin/snmp/server_snmp.sh server_3 cifsstat
...
I have a cron that runs every few minutes to update flat, parsed, text files. The snmp exec is just a simple grep of these files because of UCD-snmp limitations.
more server_5_cifsstat
SMBsMkdir_ncalls=0
SMBsMkdir_%totcalls=0.00
SMBsMkdir_maxTime=0.00
SMBsMkdir_ms_call=0.00
SMBsRmdir_ncalls=20843
SMBsRmdir_%totcalls=0.00
SMBsRmdir_maxTime=179.47
SMBsRmdir_ms_call=2.17
SMBsOpen_ncalls=0
SMBsOpen_%totcalls=0.00
SMBsOpen_maxTime=0.00

Would be noce if EMC installed XML perl modules as well.. Any EMC folks listening ?

4 Operator

 • 

8.6K Posts

September 4th, 2008 13:00

so, what you actually want it get current performance counters through SNMP (not historical data), right ?

It would be good if you could file a product enhancement request (PER) for that.

Can you elaborate whats wrong with server_stats ?

Do you have EMC ControlCenter by any chance ?

76 Posts

September 4th, 2008 14:00

Yes I get Full SNMP stats trending CPU, DISK,Memory CIFS, NFS Anything I want to parse. Including sym stats using sysmstats from symcli in /opt/.

Been down the EMC road.. They want you to buy addon products. ControlCenter is the web based UI right? no good to people with a standard solution for trending and alerting usually 90% snmp.

Can't seem to reproduce it now but I was getting out of order fields when the CPU spiked to 90%. Since we fixed the application stats have retuned to the expected fields when using server_cifstats server_# -full

Anyway It would be a lot easier to read the data from a db file then stats would match celerra manager and , I think, also expose the data we see in the other summary graphs without having to calculate and merge data points taken from different time intervals.

76 Posts

September 5th, 2008 10:00

I'm going to start this in a new thread since it seems out of context of the original question./
No Events found!

Top