I'm currently making a number of graphs for users on a server.
The code 'm using is as follows:
$RRDTOOL graph $SCUMCOUNTPATH/mtghour.png \
--start now-3600s --end now \
--alt-autoscale \
-w 343 -h 85 \
--lower-limit 0 \
--title "Last 90 Minutes" \
--color CANVAS#36393f00 \
--color BACK#36393f00 \
--color FONT#5b80e0 \
--color GRID#888888 \
--color MGRID#888888 \
--color SHADEA#36393f \
--color SHADEB#36393f \
--x-grid MINUTE:5:HOUR:20:MINUTE:30:0:%M \
--alt-y-grid --rigid \
--left-axis-format %2.0lf \
--rigid \
--watermark "$(date +'%a %b %d %H:%M %Z %Y')" \
DEF:nowcount=$SCUMCOUNTPATH/mtg.rrd:count:AVERAGE \
CDEF:up=nowcount,0,*,0,EQ,0,1,IF \
TICK:up#3b455e:1.0 \
LINE2:nowcount#5b80e0: \
GPRINT:nowcount:LAST:" Current\:%2.0lf" \
GPRINT:nowcount:AVERAGE:"Average\:%2.1lf" \
GPRINT:nowcount:MAX:"Maximum\:%2.0lf " >/dev/null
What this produces is this:
What I would like it to produce is this (Photoshopped):
Extra info:
I'm using RRDtool 1.5.5 in a linux environment and running the script with BASH scheduled with cron.
The option you require is --y-grid, or possibly --alt-y-grid.
First try using --alt-y-grid which tries to use a more intelligent algorithm to calculate optimum line placement. It might work better for you in general.
Failing that, try --y-grid 1:1. This means "put a line every 1.0, and label every line". As comparison, what you're seeing in your first graph (that you don't want) is --y-grid 0.1:10 where a line goes every 0.1 but only 1 in 10 are labelled.
More details in the RRDTool documentation here
Related
I wanted to create a Windows VM using gcloud command line.
Tried the "Equivalent Command Line" syntax - the syntax failed.
After some trial and error, discovered that the --create-disk list of parameters needs to be repeated (please observe the script below).
gcloud compute instances create ifworker-0 \
--project=ceng-test \
--zone=us-east4-c \
--machine-type=n2-standard-2 \
--network-interface=nic-type=VIRTIO_NET \
--network-tier=PREMIUM \
--maintenance-policy=MIGRATE \
--provisioning-model=STANDARD \
--service-account=the-service-account \
--scopes=https://www.googleapis.com/auth/cloud-platform \
--tags=ifworker-net-0 \
--create-disk=mode=rw \
--create-disk=size=40GB \
--create-disk=type=projects/ceng-test/zones/us-central1-a/diskTypes/pd-balanced \
--create-disk=boot=yes \
--create-disk=auto-delete=yes \
--create-disk=image=projects/windows-cloud/global/images/windows-server-2022-dc-core-v20220513 \
--no-shielded-secure-boot \
--shielded-vtpm \
--shielded-integrity-monitoring \
--reservation-affinity=any
However, even then the script is failing - the error is reproduced below.
ERROR: (gcloud.compute.instances.create) Could not fetch resource:
- Invalid value for field 'resource.disks[0]': '{
"type": "PERSISTENT",
"mode": "READ_WRITE",
"boot": true,
"initializeParams": { },
"autoDele...'.
Boot disk must have a source specified.
Need some guidance here. Thanks for your attention and time.
As checked on your command, boot and image properties should be in the same line.
It should look like this.
--create-disk=boot=yes,image=projects/windows-cloud/global/images/windows-server-2022-dc-core-v20220513
Based on GCP's documentation the image properties should be included in the same line with --create-disk=[PROPERTY=VALUE,…] parameters, specifying the name of the image that will be initialized.
Below is the command that worked on my end:
gcloud compute instances create ifworker-0 \
--project=<project_name> \
--zone=us-east4-c \
--machine-type=n2-standard-2 \
--network-interface=nic-type=VIRTIO_NET \
--network-tier=PREMIUM \
--maintenance-policy=MIGRATE \
--provisioning-model=STANDARD \
--service-account=the-service-account \
--scopes=https://www.googleapis.com/auth/cloud-platform \
--tags=ifworker-net-0 \
--create-disk=mode=rw \
--create-disk=size=40GB \
--create-disk=type=projects/ceng-test/zones/us-central1-a/diskTypes/pd-balanced \
--create-disk=boot=yes,image=projects/windows-cloud/global/images/windows-server-2022-dc-core-v20220513 \
--create-disk=auto-delete=yes \
--no-shielded-secure-boot \
--shielded-vtpm \
--shielded-integrity-monitoring \
--reservation-affinity=any
Note:
Change <project_name> and/or service account details.
For "gcloud compute instances create" there should be only one --create-disk line per disk. In other cases multiple disks are created.
As we want only one disk, there should be only one line, with all parameters delimited by ",".
The correct example follows.
gcloud compute instances create ifworker-0 \
--project=<project_name> \
--zone=us-east4-c \
--machine-type=e2-micro \
--network-interface=nic-type=VIRTIO_NET \
--network-tier=PREMIUM \
--maintenance-policy=MIGRATE \
--provisioning-model=STANDARD \
--scopes=https://www.googleapis.com/auth/cloud-platform \
--tags=ifworker-net-0 \
--create-disk=mode=rw,size=40GB,type=projects/<project_name>/zones/us-central1-a/diskTypes/pd-balanced,boot=yes,auto-delete=yes,image=projects/windows-cloud/global/images/windows-server-2022-dc-core-v20220513 \
--no-shielded-secure-boot \
--shielded-vtpm \
--shielded-integrity-monitoring \
--reservation-affinity=any
I want to purge my parachain collator node, but I got this error
Input("Error parsing spec file: missing field `relay_chain` at line 143 column 1")(cannot purge parachain)
This is the command I used to purge my parachain
./target/release/parachain-collator purge-chain --base-path /tmp/parachain/alice --chain rococo-custom.json
This is the command I used to run this parachain-collator
./target/release/parachain-collator \
--alice \
--collator \
--force-authoring \
--parachain-id 2000 \
--base-path /tmp/parachain/alice \
--port 40333 \
--ws-port 8844 \
-- \
--execution wasm \
--chain rococo-custom.json \
--port 30343 \
--ws-port 9977
Thank you so much for your help!
./XXX/parachain-collator purge-chain --base-path <your collator DB path set above>
no need args for chainspec.
Runnning the dataeng-machine-learning codelab on step 9. 4. Feature Engineering.
The notebook step for running a tarin job is:
%%bash
OUTDIR=gs://${BUCKET}/taxifare/ch4/taxi_trained
JOBNAME=lab4a_$(date -u +%y%m%d_%H%M%S)
echo $OUTDIR $REGION $JOBNAME
gsutil -m rm -rf $OUTDIR
gcloud ml-engine jobs submit training $JOBNAME \
--region=$REGION \
--module-name=trainer.task \
--package-path=${REPO}/courses/machine_learning/feateng/taxifare/trainer \
--job-dir=$OUTDIR \
--staging-bucket=gs://$BUCKET \
--scale-tier=BASIC \
--runtime-version=1.0 \
-- \
--train_data_paths="gs://$BUCKET/taxifare/ch4/taxi_preproc/train*" \
--eval_data_paths="gs://${BUCKET}/taxifare/ch4/taxi_preproc/valid*" \
--output_dir=$OUTDIR \
--num_epochs=100
That works great no matter how many time I run it.
However if I run:
%%bash
OUTDIR=gs://${BUCKET}/taxifare/ch4/taxi_trained
JOBNAME=lab4a_$(date -u +%y%m%d_%H%M%S)
echo $OUTDIR $REGION $JOBNAME
gsutil -m rm -rf $OUTDIR
gcloud ml-engine jobs submit training $JOBNAME \
--region=$REGION \
--module-name=trainer.task \
--package-path=${REPO}/courses/machine_learning/feateng/taxifare/trainer \
--job-dir=$OUTDIR \
--staging-bucket=gs://$BUCKET \
--scale-tier=BASIC \
--runtime-version=1.0 \
-- \
--train_data_paths="gs://$BUCKET/taxifare/ch4/taxi_preproc/train*" \
--eval_data_paths="gs://${BUCKET}/taxifare/ch4/taxi_preproc/valid*" \
--output_dir=$OUTDIR \
--num_epochs=100 \
--verbosity DEBUG
Job fails after about 40 sec. with this in the logs:
The replica master 0 exited with a non-zero status of 2. Termination reason: Error.
I've found this usage in here:
https://cloud.google.com/ml-engine/docs/how-tos/getting-started-training-prediction#cloud-train-single
So I guesss it's ok to use.
What am I doing wrong?
Note that every argument after the "-- \" line is a pass through to the tensorflow code and is therefore dependent on the individual sample code.
In this case, the "--verbosity" flag isn't supported by the sample you are running. Looking at the samples repo, it looks like the only sample that has that flag is the census estimator sample.
The taxifare example is currently hardcoded to INFO, and the code doesn't parse the --verbose flag.
I added texturePacker script to export sprite sheet and its working. I would like to know how to set 'Pre Multiply Alpha' and 'NPot any size' while exporting sheet through Xcode script?
Here is my present Code:
TP="/usr/local/bin/TexturePacker"
${TP} --smart-update \
--format cocos2d \
--padding 2 \
--main-extension "-ipadhd" \
--autosd-variant 0.5:-ipad \
--autosd-variant 0.5:-hd \
--autosd-variant 0.25: \
--opt RGBA8888 \
--data iOS/Resources/Game_SpriteSheet/CBirdSpriteSheet_1-ipadhd.plist \
--sheet iOS/Resources/Game_SpriteSheet/CBirdSpriteSheet_1-ipadhd.pvr.ccz \
SpriteSheet/Sprite_Sheet_1/*.png
Screenshot from external texture packer. I want same in script.
Have you tried adding the --premultiply-alpha and --size-constraints <value> options to the command? [1]
TP="/usr/local/bin/TexturePacker"
${TP} --smart-update \
--format cocos2d \
--padding 2 \
--main-extension "-ipadhd" \
--autosd-variant 0.5:-ipad \
--autosd-variant 0.5:-hd \
--autosd-variant 0.25: \
--opt RGBA8888 \
--premultiply-alpha \
--size-constraints NPOT \
--data iOS/Resources/Game_SpriteSheet/CBirdSpriteSheet_1-ipadhd.plist \
--sheet iOS/Resources/Game_SpriteSheet/CBirdSpriteSheet_1-ipadhd.pvr.ccz \
SpriteSheet/Sprite_Sheet_1/*.png
[1] http://www.codeandweb.com/texturepacker/documentation
I am trying to figure out how to find the % based on two data sources from an RRD graph. Below is the code used to create the graph (generated by Cacti)
/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=1256445701 \
--end=1256532101 \
--title="Message Size" \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
COMMENT:"From 2009/10/25 14\:41\:41 To 2009/10/26 14\:41\:41\c" \
COMMENT:" \n" \
--vertical-label="" \
--slope-mode \
--font TITLE:10: \
--font AXIS:8: \
--font LEGEND:8: \
--font UNIT:8: \
DEF:a="/srv/www/vhosts/cacti/cacti-0.8.7d/rra/5393.rrd":dsAttachmentSize:AVERAGE \
DEF:b="/srv/www/vhosts/cacti/cacti-0.8.7d/rra/5393.rrd":dsSIAttachmentSize:AVERAGE \
CDEF:cdefa=a,1000000,* \
CDEF:cdefe=b,1000000,* \
AREA:cdefa#0000aaFF:"Attach Size" \
GPRINT:cdefa:LAST:" Current\:%8.2lf %s" \
GPRINT:cdefa:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:cdefa:MAX:"Maximum\:%8.2lf %s\n" \
AREA:cdefe#FF0000FF:"Attach SI Size" \
GPRINT:cdefe:LAST:"Current\:%8.2lf %s" \
GPRINT:cdefe:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:cdefe:MAX:"Maximum\:%8.2lf %s\n"
I would like to find the following (A - B) / A * 100 and display it at the bottom of the graph.
I think this question is more programming related then server related (but I am ready to stand corrected), if anyone can point me to some good documentation on RRD to figure this out myself or if anyone can give me a good start it would be greatly appreciated.
Cheers.
This was a relatively easy one in the end. Just create a CDEF function like the following.
a,b,-,a,/,100,*
And assign that CDEF function to a graph item without a datasource.