I recently decided to do a fresh CentOS install on a web server with a minimal amount of sites on it because it seemed easier than attempting to upgrade everything. With a fresh install I figured I would be forced to get everything completed quicker. The server was upgraded from CentOS 5.1 to CentOS 5.3 and from ISPConfig 2.X to ISPConfig 3.X. One of the virtual host configurations was for a Nagios server that monitors a fairly large list of servers running various services from basic server items like CPU, Load, Disk Space, etc. all the way to complex PostgreSQL statistics and other custom items. There are numerous Perl scripts to monitor PostgreSQL including check_pg_connections.pl, check_pg_lock_status.pl, check_pg_max_xid.pl, check_pg_queries.pl, check_pg_time.pl, and check_pg_waiting_queries.pl. The scripts use the DBD-Pg Perl module to make a connection (remote or local) to PostgreSQL servers.5.8.8, 5.8.9, bootstrap, CentOS, check_pg_connections.pl, CPAN, DBD::Pg, DynaLoader.pm, error, ISPConfig, libraries, library, nagios, object, perl, perl-DBD-Pg, PostgreSQL, psql, RPM, version
Posts Tagged “object”
Jul 15 2009
If you want to dynamically add a member to a Ruby object, use the hash/array brackets and symbol (:user_id) as shown in the iRb session below. As you can see the dot notation will not work.
>> d = AccessMode.find(1) => #<AccessMode id: 1, device_id: 31218, mode: "dialup", timestamp: "2007-12-25 15:52:55"> >> d[:user_id] = 5 => 5 >> d => #<AccessMode id: 1, device_id: 31218, mode: "dialup", timestamp: "2007-12-25 15:52:55"> >> d.user_id => 5 >> d.user_id = 6 => 6 >> d.session_id = 10 NoMethodError: undefined method `session_id=' for #<AccessMode:0x58dace8> from C:/chirag no backup/haloror/vendor/rails/activerecord/lib/active_record/attribute_methods.rb:251:in `method_missing' from (irb):23Tags: activerecord, array, brackets, hash, irb, object, Ruby, session, symbol
I decided to use BackgrounDrb 0.2.1 to launch a periodic task that would run every 15 seconds.Warning: After going through the hassle of setting up BackgrounDrb, I found out that it isn’t even supported in Windows (my dev environment)! See step 8. So, these instructions haven’t been fully tested yet on a
Aug 10 2008
I recently installed a really nice set of charts and graphs called XML/SWF Charts using the Ziya plugin for Rails. The nice part is that it costs only $45 for your entire domain. This license fee will remove the link when you click on the chart (it currently goes to their website)
For the most part, the instructions in Ziya’s README were very good. I did run into a few snags, but they didn’t take me too long to figure out. Here’s a rundown. Hopefully this will make it even easier to implement Ziya and XML/SWF:
Under the “Steps” section of the the README:
1. If you get an error message when trying to install the Rails plugin on Windows, be sure to install the Window’s subversion client. This will install the command line svn client and add the subversion path to your environment variables. Be sure to open a new command prompt after installing the subversion client. This is the quickest way to get the latest version 0.12 of Ziya since they don’t make the latest code downloadable.
2. There’s an obvious typo in the following line
I changed it to the following to get something working quickly:
graph = Ziya::Charts::Line.new( nil, nil, "mychart" )
3. My biggest mistake: You can not instantiate the Ziya object in the controller corresponding to the chart’s view. It needs to be in a separate controller. Otherwise, an XML file (instead of a chart) will be returned when that controller is invoked.
In other words, if the following view code is in
<%= ziya_chart( url_for( :controller => 'blee', :action => 'refresh_my_graph' ), :id => 'css_id', :bgcolor => "transparent", :width => 400, :height => 250 ) %>
Then you cannot put the following code in the
def line_chartgraph = Ziya::Charts::Line.new( nil, nil, "mychart" )graph.add( :axis_category_text, [ "Dog", "Cat", "Rat"] )graph.add( :series, "Series A", [10, -20, 30] )render :xml => graph.to_xmlend
The controller name needs to be different. They used
4. The parameters passed into into the
The best way to specify attributes in the YAML stylesheet is to look at XML/SWF’s reference. It is very well documented and very understandble.
5. I was able to get their sample charting application working pretty quick. It’s the code for Ziya’s website. Download it by typing this at the command prompt (after you’ve done #1 above)
svn co svn://rubyforge.org/var/svn/liquidrail/samples/charting
After you download it, you will need to
Thanks a lot to the folks at maani.us for providing such a nice and rich set of graphs and charts for next to nothing. And also thanks to Fernand Galiana and Delynn Berry for such a nicely written plugin to the Rails community!Tags: chart, controller, Flash, graph, object, plugin, rails, ruby on rails, stylesheet, svn, swf, windows, xml, yaml, ziya