Thursday, April 21, 2011

RHQ 4 candidate release is out and waits for testing

RHQ

 

RHQ team is planning to release RHQ 4 end of next week. And while we know that there are areas that need more love, we want to encourage every one to test the release candidate, RHQ 4 CRover the long week end and report back (critical) bugs, so that we have a chance to fix them for the final version.

Download is on SourceForge and the release notes can be found on rhq-project.org.

Speaking of giving some love: if you are willing to do some translations of the UI messages into your native language, please contact me.

Monday, March 21, 2011

RHQ tab sweep

We had a productive time since last tab sweep and released a third developer preview of RHQ, as well as RHQ 4.0.0 Beta 1. Please give the beta a try and report issues, as well as file feature requests.

The JBoss developers webinars series had a session about RHQ. The recording is available on Vimeo.

Ian Springer has answered the forums post about "JBoss AS 5.1 and RHQ"

IRC

As you probably know, RHQ team is hanging out on IRC in irc://irc.freenode.net/#rhq. If your access to IRC is blocked for whatever reasons, you can still try to use the web front end to join us.

Blog postings

I've written: An explanation of metrics and their per minute counterparts

Mazz has written two blog posts: Alerting and Remote Script Execution and an update on Bundle provisioning with RHQ both with flash demos.

Speaking of Bundles, John Sanda has created a bundle receipt for deploying JBossAS.

Lukáš Krejčí has written about running CLI scripts as alert notifications. This feature made it into RHQ 4 beta 1.

Jay Shaughnessy has written a hint about regular expression evaluation in GWT.

Developer mailing list (subscribe here)

We had some discussions about a new Auditing subsystem (this would be a great topic to start RHQ hacking, as this can be (mostly) done in great isolation to the existing code base.

Another discussion went around the new Summary/Activity pages for groups and about displaying recent package history and bundle deployments on those.

 

Monday, March 14, 2011

RHQ 4 beta 1 available

Last week the first beta version of RHQ 4 has been made available. This beta is the first large milestone towards a RHQ 4 release later this year. The bigest part of the UI has been transitioned to GWT and is now in a state for serious testing.

One new cool feature made it in to the beta (since the last DP3 release): there is now an alert sender that can run CLI scripts when an alert has fired.

Check the release notes page which also contains the link to the downloads.

As always: please give us feedback!

Tell us your story about RHQ

We are interested on how you use RHQ. Please reply in the forums or the rhq-users mailing list

Friday, February 18, 2011

RHQ 4 DP3 is out, webinar recording available

The third preview of RHQ 4 has been released yesterday.

From the release announcement:

We have just released RHQ 4.0 Developer Preview 3. This release is 
intended for developers and other interested parties who want a 
first-hand look at upcoming changes in RHQ 4.0, in particular the new 
GWT UI. Please note that this release is not intended for production use 
or serious testing.

New Features:
* Improved dashboard
* Improved operations UI (for single resource)
* Improved bundles UI
* System settings have been ported to GWT
* Support for Postgres 9.0
* Support for deleting agent plugins

The release notes tell you more and also contain the download link.

Two weeks ago, I have given a webinar "Overview of RHQ and JBossON". The recording is now available from Vimeo:

 

Overview of RHQ and JBoss Operations Network from JBoss Developer on Vimeo.

 


Friday, February 04, 2011

Metrics in RHQ and their per minute counterparts

In RHQ we support some kinds of metrics:

  • Dynamic: metric values are 'randomly' going up and down. An example could be the free main memory of a computer
  • Trendsup: a metric whose values are monotonically increasing. This could e.g. be the number of transactions committed or request served
  • Trendsdown: the counterpart of trendsup where values are monotonically decreasing.

Usually the absolute number of commits or requests does not really tell much. More interesting is the dirst deviation by time: how many requests are coming in per minute. Here you can directly see if you have a request storm coming in or if it is quiet.

Now lets have a look at an excerpt from a screen shot of the metrics table in RHQ:

 

Metrics2
Screenshot from RHQ UI (non-interesting lines cut out)
Here we see that the minimum number of requests served in the last 1day was 327.100 and the maximum number was 333.540. This sounds strange at first glance. Actually this does not mean within the last 24h we served somewhere between 327k and 333k requests, but rather that at the start of the last 24h period, the counter was at 327k and at then end it was at 333k. The following diagram illustrates this:
Metrics3
The position in time of the green bar is "now".
And now we can do the math:
333540 - 327100 = 6440 requests in the last 24h
6440 / ( 26 * 60 ) = 4.47 requests per minute (on average)
And those 4.47 requests are the 4.6 you see as avg. requests per minute in above graph (modulo some rounding issues).

The counter for "requests served" will be reset to zero when the web-app is started again e.g. by fully restarting the web-container (or app server) .

 

Wednesday, January 12, 2011

Please take a few seconds for a poll about RHQ 4

Please take a few seconds for this poll to tell us what you think about RHQ 4 so far.

You need to be logged in with your JBoss community account. Then just select an option and click on submit. Done.

Of course you can leave comments on that page too. The poll ends in two weeks.

Thanks

Monday, January 10, 2011

RHQ tab sweep (updated)

Issue 2/2011 of German JavaMagazin features a 5 page article about RHQ. Currently this is available in the printed version, and also on the JavaMagazin home page later on.

There is a new video on Vimeo about using the standalone plugin container for plugin development. The start scripts are now also available for download from SourceForge.

If you don't want to run the agent as root, but need to access resources like postgresql.conf, use ACLs.

If you want to monitor apache httpd, you can try an experimental plugin that uses mod_bmx to talk to apache (the GitHub downloads section contains a binary version of the plugin; you still need to install mod_bmx in httpd).

John Sanda has written a plugin, that can use Clojure files to do the actual plugin work. So if you find writing the plugin code in Java boring, just use Clojure :-) (See also this article from John).

And then of course RHQ 4 DP 2 is out (since start of December).

And last but not least:

The Cool Stuff section of the JBoss community website now has some RHQ wallpapers.

Thursday, December 30, 2010

Running the RHQ agent as root? Alternatives? ACLs!

 

Some RHQ plugins require access to some resources that are normally only readable by root or the respective owner. The example I am using here is the postgres plugin. This plugin needs access to $PGDATA/postgresql.conf in order to show the configuration in the UI (and to possibly update it).

Unfortunately postgres requires this file to be owned by user postgres and only be read(-writable) by this user (mode 600) and the directory containing this file ($PGDATA) is also required to be owned by user postgres and only be accessible by user postgres (mode 700).

 

One way to access the data it to run the RHQ agent as root and be done. But even if the agent does not do any harm, many admins don't feel comfortable with it - especially when using plugins from third parties that they don't have the source for. Or when using the script plugin, which can use shell scripts to do its work.

Luckily there is an easy way to get around this limitation: ACLs

ACL (access control lists) are a posix feature that is implemented in most (all) modern system these days. The way to set and query them are different unfortunately.

On Red HatEnterprise Linux (and Fedora and probably all other Linuxes) you can set them like this ('hrupp' is used as agent user):

postgres$ pwd
/var/db/postgres
postgres$ setfacl -m u:hrupp:rw $PGDATA/postgresql.conf
postgres$ setfactl -m u:hrupp:x $PGDATA

ls shows that there are ACLs enabled:

root# ls -lsa
8 drwx--x---+ 13 postgres postgres 4096 Dec 21 14:04 .
24 -rw-rw----+ 1 postgres postgres 16872 Dec 17 12:11 postgresql.conf

See the little + in the perms? That indicates an active ACL. Those can be queried via getfacl:

root# getfacl .
# file: .
# owner: postgres
# group: postgres
user::rwx
user:hrupp:--x
group::---
mask::--x
other::---

 

root# getfacl postgresql.conf
# file: postgresql.conf
# owner: postgres
# group: postgres
user::rw-
user:hrupp:rw-
group::---
mask::rw-
other::---

Also remember that the mount options need to enable ACLs first.:

root# grep acl /etc/fstab
/dev/mapper/VG_data-data1 /var/db ext4 defaults,acl 1 3

 

On Mac OS X the command to see them in directory listings is 'ls -lea' (shown below). To set an ACL you can use chmod (here 'hrupp' is used as agent user):

postgres$ pwd
/var/db/postgres
postgres$ chmod +a "hrupp allow read,write" postgresql.conf
postgres$ ls -le postgresql.conf
 -rw-------+ 1 postgres  postgres  16759 Jul 22  2009 postgresql.conf
0: user:hrupp allow read,write
postgres$ chmod +a "hrupp allow execute" .
postgres$ ls -lea
drwx------+ 23 postgres  postgres    782 Dec 30 15:00 . 
0: user:hrupp allow search
-rw-------+  1 postgres  postgres  16759 Jul 22  2009 postgresql.conf 
0: user:hrupp allow read,write

The '0:' tells us that this is the first acl on the file. If there were more acls set, they would be enumerated there as well and evaluated in order.

 

I have been told that recent Windows versions also support POSIX ACLs, so this should work there as well.

---

This tip was brought to you by the excellent RHCSA training.

 

Wednesday, December 29, 2010

A pitfall in PendingIntent (with solution)

The Android documentation has a nice overview chapter about how to notifiy the user with status bar notifications.

The example text works quite nicely and the user gets informed and can then call back into the application. But when working on Zwitscher it did not work as intended by me. But lets start slowly.

Setting up a notifiction goes along the lines of (taken from the developer guide):


Intent notificationIntent = new Intent(this, MyClass.class);
PendingIntent contentIntent =
PendingIntent.getActivity(this, 0, notificationIntent, 0);
notification.setLatestEventInfo(context, "Title",
"something went wrong", contentIntent);

where a PendingIntent is set up as a "pointer" and stored by the system so that when the user selects the notification in the status bar the target activity specified in the notificationIntent can be called.

Now sometimes you want to attach some additional data to the intent to be delivered - like a longer explanation why your action failed. You would go like:

Intent notificationIntent = new Intent(context,MyClass.class);
notificationIntent.putExtra("key","value");        
notificationIntent.putExtra("key2",someCounter++);

to add the payload. And in MyClass you would get the data via

Intent intent = getIntent();        
Bundle bundle = intent.getExtras();        
String head = bundle.getString("key");        
Integer body = bundle.getInt("key2");

Now when the notification fires,  the intent is created and attached to the PendingIntent and this shows up in the status bar

User then selects the status bar to see the longer message and presses this area to see the full details. This means that the system delivers "out of the blue" the created Intent message and thus starts MyClass-activity, which then pulls the payload from the intent.

When you do this a few times in a row you will see that the passed counter (someCounter) does increase in your sending activity, but that the receiver always shows the initial value. Canceling the notification in the sender does not help here.

This comes from the fact, that the system does not assume that only because we pass a new Intent object to the pending intent, we want this new intent object to be delivered and just keeps the old (initial) pending intent alive.

To get the desired semantics, we need to pass a flag to tell the system:

PendingIntent pintent = 
PendingIntent.getActivity(context,0,intent,PendingIntent.FLAG_CANCEL_CURRENT);


This flag (FLAG_CANCEL_CURRENT) tells the system that the old pending intent is no longer valid and it should cancel (=remove) it and then create a fresh one for us. There are more possible flags, which are described on the javadoc page for PendingIntent.

 


You can see a full example in the Zwitscher source code on github in the

And remember that Zwitscher is live on the Android market - download and try it :-)

Saturday, December 11, 2010

Zwitscher is on the market

Zwitscher, my Twitter client for Android(*) is now available in the Android-Market.

zwitscher_on_market.png

 

While v0.50 has still rough edges it is what I am basically using as my main and only Twitter client on my mobile. I've completely deleted the official Twitter app :-)

Zwitscher is open source and hosted on GitHub.

Thursday, December 09, 2010

New preview release of RHQ 4 available

 

We have just made a new developer preview release of RHQ available. This release features a lot of changes and improvements in the UI, that is rewritten in GWT.

 

 

Rupp_RHQ_Dashboard.png

Major new features:

  • Improved LDAP support
  • Default dashboard improvements
  • Improved Resource Inventory support
  • Breadcrumbs no longer used
  • I18N
  • New Help section: Docs from the www.rhq-project.org are now available directly through the app.
  • GWT-based user and role edit views finished
  • Metric and Alert template views converted from JSF to GWT
  • Much improved MySQL plugin (by Steve Milidge)

More detailed release notes can be found here: http://rhq-project.org/display/RHQ/Release+Notes+4.0+DP2

Please check out this release and give us as much feedback as you can. Also we are very interested in getting more translations

The release can be downloaded from the link within the release notes

Thanks to everyone who contributed. Heiko (on behalf of the RHQ team)

 

Wednesday, December 08, 2010

I am a RHCSA now :-)

Last week I spend the whole week in the Red Hat training center here in Stuttgart, participating in the Red Hat Certified System Administrator (RHCSA) fast track course and exam. The RHCSA is probably still very unknown and better known under its previous name "RHCT". RHCSA runs on RHEL 6.

The fast track training consists of some more basic aspects of system administration like installing and enabling services, setting up networking in the first half and some more advanced topics like ACLs, SELinux, LVM (with encryption and snapshots) in the second part. The course material works with brand new RHEL 6 stuff and also the exam is on RHEL 6. Top notch!

Friday was exam time. As I am not allowed to talk about this only so far: this is a real-world get things done kind of exam and not some multiple choice test.

And then I was waiting for exam results - and today I got it: I passed and I am now a RHCSA! :-)))

Cert number is 100-003-383

 

Tuesday, December 07, 2010

PGDayEU 2010

I had the big luck to be able to attend the first day of PGDay EU conference here in Stuttgart. Conference was held at the SI-Erlebniszentrum - a location well known to me as the Java Forum Stuttgart took place there for many years.

The conference had around 200 attendees and the main tracks were given in two large rooms. Almost all of the "celebrities" like Simon Riggs, Dave Fetter, Magnus Hagander, Heikki Linnegas, Bruce Momijan (with this son!) were there.

I am not too much a database expert, so talks were very technical to me :) But not non-understandable :-)

One definitively cool talk was given by Gianni Ciolly from 2ndquadrant: he was playing chess against postgres (http://twitpic.com/3dfojr and http://yfrog.com/2q3nq01j). Gianni showed the SQL involved and then played against the DB. The chess figures involved were just done by UTF-8 characters :-)

Bruce Momijan talked about rapid upgrades from 8.x (or even 9.0) to 9.x via the re-written db_upgrade. With it upgrades of a huge database can take as little as 44 seconds (in link mode). Definitively something to have a look at.

After lunch I talked about "Servermonitoring mit RHQ" (in German). I had ~ 40 attendees, which was nice. There definitively was interest and I got some good questions afterwards. I've put my slides online at http://www.pilhuhn.de/hwr/misc/PGDay_EU_2010.pdf . If you want to know more about RHQ, visit http://rhq-project.org.

After attending Simon Riggs' talk about replication, I went to Devrim Gündüz, who was talking about failover using the Red Hat Cluster suite. This talk was very nicely presented with a lot of involvement of the speaker :-)

In the evening EnterpriseDB sponsored a party with food and drinks. There were lots of interesting talks at the tables going on, people all were very nice.

So this PGDay was a very positive experience for me. Unfortunately I could not make it to the 2nd day with more interesting talks.

Saturday, November 20, 2010

Using formatted text (in code) on Android

Putting text into a TextView on Android is easy - you just use TextView.setText(text) unlike other overloaded methods with the same name, you can not just use a String with Html formatting to format the passed text.

In order to do so, you either need to obtain the text from a resource file, use Html.fromHtml(String html) helper method or create a SpannableString that can then be passed to the method.

Html.fromHtml() is actually very convenient:

String s = "This is a <b>fat</b> string";
TextView tv = .. ;
tv.setText(Html.fromHtml(s));

But while working on Zwitscher I saw that Html.fromHtml() is actually very expensive to use, as internally it is using the whole arsenal of XML parsing.

Plan B is using SpannableString...

Creating such a text is a bit complicated as you need to deal with individual Spans and so on, which I found inconvenient.

So I've introduced a SpannableBuilder helper class to make this process easier.

Usage is as follows:

SpannableBuilder builder = new SpannableBuilder(context);
builder.append(status.getRetweetedStatus().getUser().getName(),Typeface.BOLD)      
.appendSpace()
      .append(R.string.resent_by, Typeface.NORMAL)                
      .appendSpace()                
      .append(status.getUser().getName(), Typeface.BOLD);
textView.setText(builder.toString());

Using this helper class does not trigger any XML parsing and is thus a lot faster than Html.fromHtml().

So far only methods that deal with TypeFaces are implemented, but extending the class for modifications of the background would be easy.

Using the camera (from your programs) on Android is easy ...

... if you know how to do it.

If you don't know it, it can be a PITA as I have e.g. described at the Android-Tech-Talk in Stuttgart.

For Zwitscher I was for quite some time trying to enable it to take pictures and upload them to pictures services like with other Twitter clients. So I started looking at the documentation and found a How To entry which basically points to the documentation for the Camera.  So I've been trying around with the preview stuff and was googling like crazy and so on, but this turned out to be too complicated for me to follow in the short term.

Yesterday I was reading about Intents in the Documentation and what Google Intents are available. This brought me to the idea of investigating if the camera could also be called that way.

So I've googled for "android camera app intent" and found this forum post which explains how to do it.

Basically start the camera via:

Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(intent, 1);

and then later when the picture has been taken fetch the picture in the onActivityResult() callback:

@Override
public void onActivityResult(int requestCode, int resultCode,Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if(requestCode==1&& resultCode==RESULT_OK) {
Bitmap bitmap = (Bitmap) data.getExtras().get("data");
}
}

This takes a small picture suitable for e.g. Twitter.

To take a larger picture you need to tell the intent where to store a larger picture and pick it up from that location.

intent.putExtra(android.provider.MediaStore.EXTRA_OUTPUT, path)

So you see - if you know all this, it is fairly easy to start the camera, take a picture and then use it later. No dealing with PreviewHolder and all that stuff.

 

Thursday, November 04, 2010

Small tip when repeatedly doing upgrade testing

Suppose you want to test upgrading your software from version x to y. This often includes updates of database schemas, tables and content.

The obvious way to do this is

do {
install version x
quit x
install version y
verify upgrade
} while (upgrade was bad)

The install version x step here is usually time consuming and involves UI interactions.

A better approach here is to

install version x
create a db backup
verified = false
while (not verified ) {
install version y
if ( upgrade good )
verified = true
else
install db backup
}

With PostgreSQL taking a backup would look like this:

pg_dump -f outfile -b -C dbname

e.g.:

pg_dump -f ~/jon231.dump -b -C jon231

and then the re-install:

pg_restore outfile

e.g.:

pg_restore ~/jon231.dump

Wednesday, November 03, 2010

Mein erster Android-Vortrag - und wie geht nun es weiter?

Gestern habe ich bei der STUGTUG in Zusammenarbeit mit der JUGS beim Android TechTalk meinen ersten Vortrag zum Thema gehalten.

Ich wurde gefragt, ob ich so über meine ersten Erfahrungen erzählen könne, was ich dann auch gemacht habe - nachdem ich mich an Hand von konkreten Beispielen in eine Materie einarbeiten muss habe ich eben von den Erfahrungen mit meiner ersten App, Zwitscher, berichtet (Folien gibt es hier und hier das Video). Peter Hoffmann hat einen Review geschrieben, wie auch Benny. Alle Videos sind in diesem Album zusammengefasst.

Die Auswertung der Feedback-Bögen gibt ein eher gemischtes Bild. Von "Sehr gut" bis "Kann ich nichts mit anfangen, weil ..."  "... ich nicht weiss was eine Activity ist", "... ich das schon seit Jahren mache" war alles dabei. Der Notendurchschnitt lag bei 2,8.

Mein Fehler war hier offensichtlich, für Anfänger in der Android-Programmierung schon zu tief in der Materie gewesen zu sein, während für die "alten Hasen" nicht so viel Neues dabei war.

Deswegen habe ich mir jetzt mal vorgenommen, möglichst bald einen Workshop für Einsteiger anzubieten, bei dem eine kleine Applikation von Null aus aufgebaut werden soll. Der Workshop wird dabei nicht nur "Frontalunterricht" sein, sondern die Teilnehmer sollen / müssen selbst Hand anlegen (Java SE Kenntnisse müssen vorhanden sein).

Hierzu nun ein paar Fragen:

  • Wird so was (= Einsteiger-Workshop) überhaupt gewünscht?
  • Was ist ein möglicher Zeitrahmen (am Abend, Samstag, Wochenende, Weihnachtsfeiertag, ...)
  • Was darf es kosten? Der Workshop ist non-Profit, aber Räume, WLAN, Getränke und Brötchen / Pizza kosten einfach Geld
  • Was für eine App soll es werden?

Ich habe auch eine Idee für einen umfangreicheren Workshop im Hinterkopf, möchte dazu erst mal noch nichts verraten ;-)