It may also be worth mentioning that this uses iMonitor's built-in
functionality and that one must still find the EID of the object to be
timestamped, probably via iMonitor or LDAP. Also while one is running the
wget command be aware that the username and password will be visible to
anybody who sees the process list (with the 'ps' or 'top' commands, for
example) so it may be worthwhile to be a bit cautious there.
Neat setup in the end. Thanks for posting about it.
Good luck.
plambrechtsen wrote:
> I figured out quite a nifty way to timestamp individual objects and then
> resync them to all replicas instead of needing to run a dsrepair -ot to
> timestamp. We can't run any repairs as our DIB has 20 million records
> in a single partition.
>
> First you need to login to iMontor and save the session cookies
>
> wget --no-check-certificate --save-cookies=cookies.txt
> --keep-session-cookies --post-data="usr=**EDIRUSERID**&pwd=**EDIRPWD**"
> https://**SERVERIP**:8030/_LOGIN_SERVER_RSP_
>
> This should all be on one line, and you replace the **EDIRUSERID** and
> **EDIRPWD** with your admin username and password. And the **SERVERIP**
> with the IP address.
>
> IE
>
> wget --no-check-certificate --save-cookies=cookies.txt
> --keep-session-cookies --post-data="usr=admin.admin&pwd=password"
> https://192.168.1.1:8030/_LOGIN_SERVER_RSP_
>
> Then you can do a timestamp of a single object ID
>
> wget --no-check-certificate --load-cookies=cookies.txt
> "https://**SERVERIP**:8030/nds/operation/data?action=timestampobj&dn=/ID%27=xxxxxxxx"
>
> And you put in xxxxxxxx the Object ID.
>
> If you change the "timestampobj" action with "sendobj" that will send
> the object to all other replicas.
>
> IE
>
> wget --no-check-certificate --load-cookies=cookies.txt
> "https://**SERVERIP**:8030/nds/operation/data?action=timestampobj&dn=/ID%27=00008000"
>
> or
>
> wget --no-check-certificate --load-cookies=cookies.txt
> "https://**SERVERIP**:8030/nds/operation/data?action=sendobj&dn=/ID%27=00008000"
>
> If you plan to use it in a dos batch file you need to add two %% signs
> between the ID and the 27
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iQIcBAEBAgAGBQJLCIcTAAoJEF+XTK08PnB5sM4P/3LJu/++RMXaUfRLs/P+lq+x
cbRL5r9BPBagX492lVo9/mgQxGx8x0zbGLaJcyQfchbABjEBmCKmL7DbrQap1hKZ
iATC/ndRGyQa/1VmkMPW++nsjP6lEUeue75kjuShCrZxIEnbChlXYU3W4+deGoJn
d3H4UAlrlAM79Yvi0p48h/iu35nuouHotKQJ7IL2q3mePr6VCWdWbjcF5oKIaPqf
r/0nX5+pUAzj9r7ef08O99iW1loKpSzaL93FX28UDYiXZBZe2ACmCmU86M+/cW8m
jBLyUpGLEqoN4Infn+qkFWsH98GjpYfPXpG29LUezkDG4Qa+5IyuuTBTmUzX6v3E
FFjhltMyqNbQoiw7on9RIhWIEVNauUjR/1nDIKcwEPMSWOJEY18FNysfV6kmL69a
n72kO+CmR3NUdkn0fJk7sU3cR91frNM77sXYdK/0sSyrJJ26K9smZOmZK6cBZy7M
TTe9ZLUhhooFFkx+eb8VKcccGK+JdDR+WHNXUH02uJqOr4hVtUOrAvLdbGQFPKEt
ApHfLS2NjfWgNt3n6rX53BqTer1aPwV248A7Cmc8KSG1971lGEypd2A/7aVTyz2i
BiiehGacxauqYW2S3ZsKCPKJyyZVEwNENc4ncIWgubnSjPPt6HbzxSTJchOXxoyJ
Ocx+FTUYhB9+kFJY5BK6
=7x8s
-----END PGP SIGNATURE-----
I'm considering having this published as a cool tool, but as the idea for
it came form you I'm hesitant for fear of looking like too much of a pig.
Up to you to decide:
<code interpreter='/bin/bash'>
#!/bin/bash
#
#Author: Aaron Burgemeister
#Author E-Mail: a...@novell.com, daj...@gmail.com
#Version: 0.1.20091123180000Z
#Description: A script to timetsamp a bunch of objects based on an
obituary report from iMonitor.
# This script does not generate the report but once a report
is created in iMonitor
# the administrator should be able to run this script as shown
below and timestamp
# all entries that were returned in the report quickly.
#
#Usage: ./obitTimestamp.sh serverHere userDNHere passwordHere
#Ex: ./obitTimestamp.sh myserver.novell.com admin.user.system secret
#Inspired By: Peter Lambrechsten's post here:
http://forums.novell.com/showthread.php?t=393511
EDIRHOST=$1
EDIRUSER=$2
EDIRPASS=$3
COOKIEFILE=cookies.txt
HTMLOUTFILE=outputFile.html
#Handle login later with a login now, saving cookies to a file for use later.
wget --no-check-certificate --save-cookies=$COOKIEFILE
- --keep-session-cookies --post-data="usr=$EDIRUSER&pwd=$EDIRPASS" -O
/dev/null https://$EDIRHOST:8030/_LOGIN_SERVER_RSP_ 2>/dev/null
#Get a list of reports to a file.
wget --no-check-certificate --load-cookies=$COOKIEFILE -O $HTMLOUTFILE
"https://$EDIRHOST:8030/nds/reports/data" 2>/dev/null
#Get report list for user to choose from. This requires the user to know
which report is current. Hitting the wrong report will not likely hurt
anything too much.
declare REPORTARRAY=(`grep 'nds/reportview' $HTMLOUTFILE | awk '{print
$2}' | awk -F '"' '{print $2}' | sort -u`) 2>/dev/null
ctr0=0
echo
echo Please choose one of the following reports from which to retrieve
echo obituaries. If none show below then please run an obituary report
echo in iMonitor and run this script again.
echo
'http://www.novell.com/documentation/edir88/edir88/data/acavuil.html#acaw95b'
echo
for i in ${REPORTARRAY[@]}; do
echo $ctr0 ' ' $i
let ctr0=ctr0+1
done
echo
echo -n Selection:
read USERSELECTION
if [[ "x${REPORTARRAY[$USERSELECTION]}" != 'x' ]] ; then
echo ${REPORTARRAY[$USERSELECTION]}
else echo 'Invalid Selection' && echo && rm $COOKIEFILE $HTMLOUTFILE && exit
fi
#Get the report's contents writing all objects to a file.
wget --no-check-certificate --load-cookies=$COOKIEFILE -O $HTMLOUTFILE
"https://$EDIRHOST:8030${REPORTARRAY[$USERSELECTION]}&ReportFile=file-3"
2>/dev/null
#Only get the objects we care about, specifically by their IDs.
OBJARRAY=(`grep '/nds/object?' $HTMLOUTFILE | grep -v alt | awk -F '>'
'{print $2}' | awk -F '<' '{print $1}'`)
#Loop through objects and timestamp them.
for i in ${OBJARRAY[@]}; do
echo 'Timestamping object with ID: ' $i
wget --no-check-certificate --load-cookies=$COOKIEFILE -O /dev/null
"https://$EDIRHOST:8030/nds/operation/data?action=timestampobj&dn=/ID%27=$i"
2>/dev/null
done
#Clean up old files.
rm $HTMLOUTFILE
rm $COOKIEFILE
<code>
Let me know if you'd rather do it yourself.
Good luck.
plambrechtsen wrote:
> a...@novell.com;1893427 Wrote:
>> It may also be worth mentioning that this uses iMonitor's built-in
>> functionality and that one must still find the EID of the object to be
>> timestamped, probably via iMonitor or LDAP.
>
> That's easy to find via iMonitor, if you run an obit report it lists
> all EID's, so if you remove all the collums you can easily create a
> batch file to take just the EIDs
>
> a...@novell.com;1893427 Wrote:
>> Also while one is running the wget command be aware that the username
>> and password will be visible to anybody who sees the process list (with
>> the 'ps' or 'top' commands, for example) so it may be worthwhile to be a
>> bit cautious there.
>
> You only need to login once, and the saving of the session cookie is
> good 10 mins, or as long as you keep on using it.
>
> So yes it will be in the ps list, for less than a second ;)
>
> I managed to timestamp 10k dead obits that were slowing up the purge
> process using this method.
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iQIcBAEBAgAGBQJLCxoaAAoJEF+XTK08PnB5OJoQAJUjrSYNlt19+vQlKK0BTeb4
xkRHHMCuClDyggc2fn5LwPfOKsli2XEeVtj0TuQiZfZaVOvazSfzWpPvOeBkakrE
hiW5dWrppYKkyHYWxIWgX74pWeUzAdtGbjoDmJwL5AolCFf39RjoVl5XuWZTv4em
rhph5ufFwXYK6JRNpaZ8SFkYml+Cp59WHeVFJM45lJyKdPq7JX4has7zfDCXcqjV
UX4ghD3A06EAMYPTkO+vSsG0e4EKbdsUR8pf5JfhjO56ItRUgGocynRSOAggERRE
2Jqg0Wf2qPnwlO4nforZuf9wDxMiXAvmE/rdWUWrduC9XdGsF+6oqfWZefsFQuaI
WAf77Cq2riTXncTzqZhgAkbyHFwXjMC/IZzOnC3QqbFJzVHFc94hZwJO2+mnRm5G
YMDkesr6TRGZ/8/c+gIFtHTEUCs4cubNK7DUs3FBhEdkHeydY++HxT5XNQcK4PEN
sLiFN9CqQ4r/wIHe0UafID5j7SVZvg4EgHAl+7PLoNAWNXXu99AVun1QnB6cktH6
xDNyd7sbqXDw5CSTgUCrbA4Mjnkfs1+keNyW7ZLYdXpAOuBpOMO5nOKIZMS5l7me
N4pqa7dOMBONI4L13Nyj45al0EN35qCG8krQ2Jy83b3Gd/bHT8aaQiJtJGHfDkcO
3k4SN6+ZDoZES1tY7JGt
=7Hte
-----END PGP SIGNATURE-----