Tuesday, July 1, 2014

How to create PNP4Nagios reports from command line

You may want some times to schedule the creation of a formal PDF report that contains information for specific Nagios services. A good solution to this is to publish reports using PNP4Nagios features for saving graphs in PDF or other formats. Some information for this process can be found in the Data export and Timeranges PNP4Nagios pages. Using this approach you may create a report that contains graphs for a specific (single) service only.

A simple example of using wget linux command is the following:

wget --user=nagiosuser --password=nagiospsswd -O cpu.pdf 'http://localhost/pnp4nagios/pdf?host=myhost&srv=CPU_Load'

In the -O you may specify the report that should be created and after that in single quotes you define the URL that will create the PDF or any other type of report:

[root@myserver ~]#  wget --user=nagiosuser --password=nagiospsswd -O cpu.pdf 'http://localhost/pnp4nagios/pdf?host=myhost&srv=CPU_Load'

--2014-07-02 09:16:18--  http://localhost/pnp4nagios/pdf?host=myhost&srv=CPU_Load
Resolving localhost... 127.0.0.1
Connecting to localhost|127.0.0.1|:80... connected.
HTTP request sent, awaiting response... 401 Authorization Required
Connecting to localhost|127.0.0.1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 217720 (213K) [application/pdf]
Saving to: βcpu.pdfβ

100%[==================================================================================================>] 217,720     --.-K/s   in 0.002s

2014-07-02 09:16:20 (118 MB/s) - βcpu.pdfβ

If there are more complex requirements for reports that contain combinations of graphs, the user has the possibility to configure the pages PNP4Nagios feature. Using this option, you may create some custom template pages that combine several services (or metrics) from several hosts in one report. After the implementation of the servers_load.cfg file you may use wget to create the related report from the command line:

wget --user=nagiosuser --password=nagiospsswd -O serversload.pdf 'http://localhost/pnp4nagios/pdf/page/servers_load?view=2'

You may use wget commands in a shell script to run under linux cron (crontab) to drop the generated reports in a folder or send them to specific recipients using email. Several people have used this approach and another in the past.

Moreover, the PNP4Nagios basket feature combines several services (or metrics) in one report. In this way, users have the option from the related PNP4Nagios web page to create, on demand, more complex reports using a link (e.g. PDF link). The possibility to create PNP4Nagios basket reports using wget is under investigation..


Tuesday, June 3, 2014

IBM i programming transformations for ILE - References


ILE is a set of tools and associated system support designed to enhance program development on the IBM i operating system.
ILE offers the following benefits over previous program models:

  • binding that it helps reduce the overhead associated with call operations, 
  • modularity, 
  • reusable components, 
  • common runtime services, 
  • coexistence of ILE with OPM programs (that support call of its other) that results in a gradual transition to ILE, and 
  • a source debugger. 
  • better control over resources, 
  • better control over language interactions, 
  • better code optimization, 
  • a better environment for C, and 
  • a foundation for the future.

  1. What exactly is ILE ???
  2. ILE for the Rest of Us
  3. Seven Steps to ILE
  4. ILE Basics: It's All About the Call
  5. ILE Basics: Procedures
  6. ILE Basics: Modules and Programs
  7. The Ins and Outs of RPG IV Calls
  8. The Case of the Missing ILE Skills
  9. Why Use Service Programs?
  10. Using ILE Activation Groups
  11. Re-engineering RPG Legacy Applications
  12. Modernizing Your RPG Applications
  13. ILE at Work: Part 1 Bound Calls and Modules
  14. cvtilerpg
  15. ILE Concepts (for the Impatient RPG Programmer)
  16. ILE Cobol/400 Hints and Helps
  17. Using Cobol/400 with ILE Activation Groups
  18. COBOL OPM to ILE conversion
  19. Use ILE Date and Time APIs from Cobol
  20. Subtracting Date Fields in ILE Cobol
  21. Retrieving a Four-Digit Year in ILE Cobol
  22. Mastering ILE Heap Memory Management
  23. Reengineering RPG Applications for the MVC Architecture
  24. ILE RPG language reference

Java (Websphere) call to RPG program - references

How to call an RPG program from Java
AS/400 Toolbox for Java PDF - IBM Redbooks
Calling RPG from Java
Calling a Program Using the iSeries Toolbox for Java
Building iSeries program calls with PCML

Other references

Scott Klement's web site
Preparing for V6R1
anzobjcvn
ANZOBJCVN APAR
IBM i Program Conversion: Getting Ready for 6.1 and Beyond


... more staff to be coming soon :-)

IBM i 6.1, 7.1 and Web Services - References

In the following list we present some useful references on IBM i integrated Web Services capabilities as well as DB2 for i Web services for versions 6.1 and 7.1.

Integrated Web Services for IBM i 

The Create Web Services Server wizard provides a convenient way to externalize programs running on IBM i, such as RPG or COBOL ILE programs, as Web services. This is available from IBM i 6.1. A screenshot is displayed below:

Web Administration GUI for IBM i
In 7.1, the integrated Web Application Server, supports Java 5 and 6 applications for 32-bit and 64-bit JVMs. The Integrated Web Services Server now supports programs in iASP, supports Static WSDL, and has shown up to 2x performance improvements.

The IBM i operating system integrates software technologies that support the externalization of an ILE (and a non-ILE ?) program object as a web service and the consumption of a web service by an ILE program object. These technologies are the integrated web services server and the integrated web services client for ILE.

In version 6.1, the tools supported only the generation of C and C++ code, and you had to manually generate the program or service program that contained the generated code. In 7.1, the tools were enhanced to generate RPG code in addition to automatically creating the service program that contains the generated code. The integrated web services client for ILE is enhanced to enable users to generate RPG code that can be used directly from an RPG application to invoke a web service.

The integrated web services client for ILE in IBM i 7.1, IBM i 6.1, and IBM i 5.4 is enhanced to support RPG stubs (proxy code) that are used directly from an RPQ application to invoke web service. This new capability does not require the user to learn web service protocols, and more importantly, everything can be done within the RPG language.

The wsdl2rpg.sh tool is enhanced to support generation of RPG web service client stubs. This is the same shell script that, for years, has supported the ability to generate C and C++ stubs given a WSDL file and generate RPG stubs. Once the RPG stub has been generated and compiled into a service program, an RPG application can then transparently invoke web service operations via the RPG stub interfaces. Users have the ability to create a service program automatically that is made up of the C and RPG stubs.

There are three critical arguments to the tool whose values are dependent on the size of expected strings, arrays, and binary data that is exchanged in SOAP messages between the client and the server. The sizes can be passed to the tool so the tool can generate fields that can contain the data without any loss. Note that even though stubs are generated, RPG files may fail to compile due to sizes of fields or data structures exceeding the language limits. For example, in IBM i 5.4 the size of a data structure cannot exceed 65535 bytes, while in IBM i 6.1, the limit is 16773104 bytes.

The wsdl2rpg.sh tool is located in the following directory: /qibm/proddata/os/webservices/v1/client/bin.

The service program that would need to be binded to is QSYSDIR/QAXIS10CC. These new web service enhancements are included in the latest level of the HTTP Server Group PTF - SF99368.

For more information check the following:

Integrated Web Services for IBM i site from IBM with a lot of information
Web services for IBM i - Getting started
Practical Web Services for RPG

Old but not odd documents:

IBM i 6.1 Technical Overview

DB2 for i Web services 

Integrate Web Services With DB2 for i 7.1 Part One, from Dawn May
Integrate Web Services With DB2 for i 7.1 Part Two, from Dawn May
Accessing Web services using IBM DB2 for i HTTP UDFs and UDTFs, white paper
HTTP RESTful services from DB2

Prerequisites

Prerequisites that are required to be installed on the system in order to use the Integrated Web Services for IBM i support.
ReleaseProduct prerequisites
7.15770SS1 Option 3 - Extended Base Directory Support
5770SS1 Option 12 - Host Servers
5770SS1 Option 30 - Qshell
5770SS1 Option 33 - PASE
5770SS1 Option 34 - Digital Certificate Manager 4 (needed only for Web services client)
5761JV1 Option 11 - IBM Developer Kit for Java (Java SE 6 32 bit)
5770DG1 - IBM HTTP Server for IBM i
Source: Integrated Web Services for IBM i - Support page
ITJungle PTF index

Thursday, May 29, 2014

Apple iOS tutorials list

Goal Application name Application functionality Learning Concepts Chapter Chapter title Environment Level
inspire an initial level of confidence, verify the development environment HelloWorld Display a message/label Single View Application, Storyboard, Label, background color, Different iOS Versions deployment, xcode, iOS Simulator 4 Creating a Simple iOS 7 App Mac, Xcode 0
View-Controller relationship, Target-Action pattern, objectivec classes, properties and methods UnitConverter Perform unit conversions from Fahrenheit to Centigrade. Single View Application, Storyboard, Label, View-Controller relationship, Target-Action pattern, IBAction, Outlets, TextField, Button, keyboard not hidden, subclassing, objectivec: properties, instance variables, instance methods, underscore prefixed variables, dot notation 6 Creating an Interactive iOS 7 App Mac, Xcode 1
Hide keyboard after pressing return in textfields or after loosing focus, first responder HideKeyboard, UnitConverter Display text field, display and then hides keyboard Single View Application, Storyboard, View-Controller relationship, Target-Action pattern, IBAction, Outlets, TextField, Button, keyboard display and hide, first responder, resignFirstResponder, connections inspector, interface builder, events 7 Writing iOS 7 Code to Hide the Keyboard Mac, Xcode 1
Auto layout and set constraints of a label AutoLayout Enable auto layout of a label Single View Application, Storyboard, Auto Layout, orientation, Constraints 9 Working with iOS 7 Auto Layout Constraints in Interface Builder Mac, Xcode 1
Auto layout of a label AutoLayoutExample Enable auto layout of a label Single View Application, Storyboard, Auto Layout, orientation 10 An iOS 7 Auto Layout Example Mac, Xcode 0
Storyboard transitions and passing data Storyboard simple application using storyboarding to implement multiple scenes with segues defined to allow user navigation Storyboard transitions, Scene, Passing data, segues, unwinding, navigation, Identity Inspector, Customize class of storyboard/scene, objectivec: properties, instance variables, instance methods, underscore prefixed variables, dot notation 14 Using Storyboards in Xcode 5 Mac, Xcode 1

Sunday, April 27, 2014

Nagios/thruk Mobile client links

Mobile client using thruk Nagios Plugin (already installed) together with pnp4nagios plugin (already used for graphs):

thruk link:
http://your-ip-address/thruk/cgi-bin/mobile.cgi



pnp4nagios link
http://your-ip-address/pnp4nagios/mobile

Services (jobs) that are in warning and critical state:
http://your-ip-address/thruk/cgi-bin/mobile.cgi#services_list?servicestatustypes=20

Wednesday, April 16, 2014

Disk replacement for Macbook5.1 (mid 2008) running Snow Leopard

This week, I had to replace the Macintosh HD main disk of a Macbook running Mac OS X Snow Leopard (10.6.8). It had been nearly full. The Macbook was a rather old aluminum case macbook5.1 version from back in mid 2008.

To do the replacement I followed the youtube videos/instructions in MacBook Pro 13" 2010 Hard Drive Upgrade Tutorial and in Macbook Hard Disk Clone & Upgrade  using Super Duper software from Shirt-Pocket. Using Super Duper you can do a disk cloning on the fly i.e. using the same macbook of which the disk you wish to clone. In this case the source disk was active during cloning. In a more perfect world, you could use a second Macbook(!) or do a system recovery to clone the original disk in an passive (not-active) state that is more safe.

To do the upgrade I used a Western Digital Scorpio Black 750GB, 7200rpm disk that can be found here. This is a high performance SATA III disk. I also used a USB to SATA box to connect the new disk (clone) to the macbook in order to do the cloning.

It is a good practice to have an updated Time Machine backup before you start...

The upgrade steps were the following:
  1. Ensure that you have the proper tools: Torx T6 and Phillips screwdrivers.
  2. Ensure compatibility of the new replacement disk with the existing hardware/software.
  3. Download and install Super Duper or Carbon Copy Cloner (that cover a Lion Recovery petition too)
  4. Connect the new 2.5 inch disk using USB-SATA box to the macbook
  5. Run Disk Utility and select Erase to format the new disk as MacOS Extended journaled as the old one, and with the same name (usually Macintosh HD).
  6. Run Super Duper (or Carbon Copy Cloner - CCC that clones the Recovery partition too) and select source and target disk carefully (!!!) to clone the old volume to the new USB connected.
  7. After waiting some hours (for a 160GB original volume the process lasts about 3 hours), Super Duper finishes the process by doing the new disk bootable. You may verify this by running command line diskutil list to see that the two volumes have the same partitions and types.
  8. Eject the USB connect new disk and shutdown the computer.
  9. Remove the back cover by taking off the screws using the Philips screwdriver. In some models you do not need to unscrew the back cover because there is a small cover with a button that when pressed you can see the battery and hard disk.
  10. Remove the battery
  11. Unscrew the protecting arm of the hard disk
  12. Slide up the hard disk and unplug it slowly and carefully
  13. Unscrew the 4 screws using the Torx. Screw them into the new disk
  14. Plug the new hard disk into the motherboard channel and mount it.
  15. Protect the disk with the protecting arm
  16. Remount the battery
  17. Close the cover
  18. Start up Macbook
  19. Test the new disk
  20. A rather long delay is expected in startup before displaying the Apple logo. To resolve this restart the Macbook by holding down Command, Option, P and R keys until you here the startup sound for a second time. After that restart the machine and the delay should be normal. Using this combination a reset of NVRAM/PRAM is accomplished. It is a good practice to do this because there is a change in hardware. In my case, there was an 80 sec delay in startup that was reduced to 30 seconds!
  21. Time Machine is not expected to continue to work for the new clone disk volume. One of the reasons is that the disk UUID is different (see Disk Utility). In Mac OS X 10.6.8, even if you fix it (update the UUID in Time Machine volume using xattr etc. - see references below) there are situations that it is not going to work. If you clone your Time Machine volume too (!), you have nothing to loose and you may try it. Be careful! Backup of the Time Machine volume is required because if you try to use the old Time Machine volume with the new source volume clone you may loose old backups in an attempt of TM to find space to create a new full backup from scratch!!!... In any case, you may use a new Time Machine backup volume for the new cloned volume and keep the old TM backups for the old original volume. For Mac OS Lion and beyond there is a command line utility called tmutil that can make the xattr/fsaclctl better... TM continuity is the most critical issue in the above process in addition with the disk selection for compatibility.
  22. After the replacement the machine runs faster and the boot time has been reduced to 33 seconds instead of 50 to 70 seconds that was with the old disk...
Useful references ...