Reports... again
-
So, I've got the reports working.
I am able to generate many different reports for different time periods now.
It required some additional scripting, so I decided to share it with those who might need it.
The idea behind the scripts is following.
We generate XML files, which is called subreports. Each subreport have its own SQL query and generate its own TimeSeries graph.
After subreports have been generated we list them in the main XML report and compile the main report from command line.Steps to teach your server to generate reports (tested on Ubuntu):
- Download packages
wget -r --no-parent https://svn.netxms.org/public/netxms/trunk/src/java/report-generator/ wget http://repo1.maven.org/maven2/net/sf/jasperreports/jasperreports/4.7.0/jasperreports-4.7.0.jar- Install required packages:
sudo apt-get install sendemail maven2 mvn install:install-file -DgroupId=jasperreports -DartifactId=jasperreports -Dversion=4.7.0 -Dpackaging=jar -Dfile=./jasperreports-4.7.0.jar- Edit pom.xml to remove unnecessary dependencies:
cd ./svn.netxms.org/public/netxms/trunk/src/java/report-generator/ nano pom.xml- Compile java package and copy it to your preferred location (I use /opt/netxms/java-lib/):
mvn clean package cp ./svn.netxms.org/public/netxms/trunk/src/java/report-generator/target/report-generator.jar /opt/netxms/java-lib/- Add the following to your netxmsd.conf (modify for your installation):
JavaPath=/usr/bin/java JavaLibraryDirectory=/opt/netxms/java-lib JDBCDriver=org.postgresql.Driver JDBCUrl=jdbc:postgresql://localhost/netxmsSteps to actually generate reports:
- Download script (xml-generation.pl, createMainXML.pm, createSubReport.pm)
- Install perl
- Modify SQL subqueries, descriptions, conditions, folder (where xml files should be stored) in the xml-generation.pl file to suit your needs. (If you are not using PostgreSQL you should also modify the DBI connection and query in createSubReport.pm)
- Run the xml-generation.pl script. It will generate subreports named <node_name>-<description>-<interval>.jrxml and main report named <interval>.jrxml
- Compile the report:
"/usr/bin/java" -cp "/opt/netxms/java-lib/report-generator.jar" org.netxms.report.Generator "/etc/netxmsd.conf" "/opt/xml-reports/hourly.jrxml" "/opt/reports/hourly.output"- Convert it to pdf:
"/usr/bin/java" -cp "/opt/netxms/java-lib/report-generator.jar" org.netxms.report.Exporter "/opt/reports/hourly.output" "/opt/reports/hourly.pdf"- And send it to your e-mail:
sendemail -f "[email protected]" -t "[email protected]" -m "Hourly report" -u "Report" -a "/opt/reports/hourly.pdf"Best regards,
Rostyslav
-
-
-
Is there any external tools by which we can generate reports on Windows Installation?
-
@phonix786 said in Reports... again:
Is there any external tools by which we can generate reports on Windows Installation?
Hi phonix, i´m using http://community.jaspersoft.com/project/ireport-designer, with iReport you can generate a jrxml file extension, this file will be used by netxms when we succesfully install reports on netxms with windows server.
I have some reports created, like capacity of switches.
Greetings.
-
I highly recommend you to use Jaspersoft Studio (http://community.jaspersoft.com/project/jaspersoft-studio) instead of iReport
-
@alk said in Reports... again:
I highly recommend you to use Jaspersoft Studio (http://community.jaspersoft.com/project/jaspersoft-studio) instead of iReport
Hi Victor, ill give a try, thanks!
Greetings.
-
I've rewritten the script to PHP. Now it is much more cleaner and easier to understand.
Link to github: https://github.com/frostyslav/netxms-report-generator
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login