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
rostyslav
Posts
-
Reports... again -
Agent upgrade from 1.2.10 to 1.2.12cat /proc/drbd version: 8.3.11 (api:88/proto:86-96) srcversion: 93CE421BB73A731BDC72D8E 0: cs:Connected ro:Primary/Secondary ds:UpToDate/UpToDate C r----- ns:926633166 nr:24520 dw:926662000 dr:2020550685 al:1982608 bm:108 lo:32 pe:0 ua:0 ap:32 ep:1 wo:f oos:0 -
Agent upgrade from 1.2.10 to 1.2.12 -
Agent upgrade from 1.2.10 to 1.2.12 -
Agent upgrade from 1.2.10 to 1.2.12Same problem here. OS: Ubuntu 12.04
-
NetXMS cluster configurationJust wanted to share how to configure a NetXMS cluster (on Ubuntu in my case).
I've used DRBD + Corosync + Pacemaker to do this, the underlying database is PostgreSQL, although it is not much different for any other database.
I won't describe how to configure DRBD and Corosync here, there are a lot of materials in the Web about this. I used this http://wiki.postgresql.org/images/0/07/Ha_postgres.pdf, it is very thorough. Only change that I did, is that I restarted corosync on both nodes after configuration.So assume you configured DRBD and have NetXMS installed. First you need to get netxms LSB-compatible init script. Good that it is already exist in the .deb packages on the site. We just need to make some changes in it (I attached the script to the post).
- Add -e to the DAEMON_ARGS parameter like this DAEMON_ARGS="-d -e -D 5". -e option will automatically unlock the database locked by previous primary server.
- Change path to the netxmsd in the DAEMON=/usr/local/bin/$NAME
Now that init script is ready place it in the /etc/init.d/ . Don't forget to make it executable (chmod +x /etc/init.d/netxmsd)
With that done we can create a crm primitive for netxms:
crm configure primitive netxmsd_lsb lsb:netxmsd \ op monitor interval="30" timeout="60" \ op start interval="0" timeout="60" \ op stop interval="0" timeout="60" \ meta target-role="Started"This primitive needs to be added to our crm group. That is easy.
user@cluster#crm crm(live)# cib new fixgroup crm(live)# configure delete PGServer crm(live)# configure group PGServer pg_lvm pg_fs pg_lsb pg_vip netxmsd_lsb crm(live)# cib commit fixgroup crm(live)# quitAnd that's all. You have working NetXMS cluster now.
-
Reports... againSo, 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
-
ReportsBecause the scheduling is not working I've came up with this solution.
Generate report from console:
"/usr/bin/java" -cp "/opt/netxms/java-lib/report-generator.jar" org.netxms.report.Generator "/etc/netxmsd.conf" "/opt/OpenVPN-report.def" "/opt/reports/`date +%d%m%Y`-openvpn-count.output"/opt/OpenVPN-report.def is our jasper report .jrxml file.
Convert this report to PDF format:
"/usr/bin/java" -cp "/opt/netxms/java-lib/report-generator.jar" org.netxms.report.Exporter "/opt/reports/`date +%d%m%Y`-openvpn-count.output" "/opt/reports/`date +%d%m%Y`-openvpn-count.pdf"And send this report via email:
sendemail -f "[email protected]" -t "[email protected]" -m "Subject: OpenVPN report `date +%d-%b-%Y`" -u "Header: Report `date +%d-%b-%Y`" -a "/opt/reports/`date +%d%m%Y`-openvpn-count.pdf"Add all of this to the cron, and we have custom reports scheduling.
All that left is to wait when these features will be available from GUI.
Edited: Attached short instruction with all necessary steps.
Best regards,
Rostyslav
-
ReportsI've got this working... kind of.
Created new custom report with http://jasperforge.org/projects/ireport software.Had some trouble with figuring out how to create a query. Here is what I end with:
SELECT object_properties.name AS nas_name, items.name AS parameter, raw_dci_values.transformed_value AS value FROM object_properties INNER JOIN items ON object_properties.object_id = items.node_id AND items.name = 'OpenVPN.Users' INNER JOIN raw_dci_values ON items.item_id = raw_dci_values.item_id AND raw_dci_values.transformed_value ~ '^[0-9]+' ORDER BY valueobject_properties table stores node names, items stores data collection items and raw_dci_values stores actual data.
I've had to slightly change this query to create a pie chart similar to those on dashboards.I attached my reports for those who might need it.
Now I'm having troubles with scheduling reports. Clicking on "Schedule report execution" do nothing.
Also is there an option on sending reports via email?
Best regards,
Rostyslav
-
ReportsAlex, thank you for the prebuild package and instruction on how to build it myself.
I've replaced report-generator.jar file with https://www.netxms.org/tmp/report-generator.jar , restarted netxms server and reports are generating.Lucas, I haven't seen this exception on my ubuntu server.
I will try to generate my own, not prebuild reports, and will post results here.
Best regards,
Rostyslav -
ReportsI am trying to generate some reports and have some troubles.
I downloaded report from https://svn.netxms.org/public/netxms/tags/version-1.2.4/reports/IP Inventory.jrxml and imported it to the NetXMS server.
Then compiled report-generator.jarapt-get install fastjar wget -r --no-parent https://svn.netxms.org/public/netxms/trunk/src/java/report-generator/ jar cvf report-generator.jar report-generator/ cp report-generator.jar /opt/netxms/java-lib/Then added this code to the netxmsd.conf
JavaPath=/usr/bin/java JavaLibraryDirectory=/opt/netxms/java-lib JDBCDriver=org.postgresql.Driver JDBCUrl=jdbc:postgresql://localhost/netxmsBut reports not generating.
Thanks for any help. -
DCI Error issueThere is no history.
-
DCI Error issueHello,
I'm trying to implement service that downloads file from my servers and gives me time of download. I am doing this via ExternalParameter.
Of course if download time is bigger then ExecTimeout in agent config I get an << ERROR >>. I want to change this error value to integer.
For example, if my download time is greater then 45 seconds, then return 60. I've tried to add the following transformation script, but it doesn't work.
Will be grateful for any help.sub main () { if ($1 < 46) return $1; else return 60; } -
DCI AggregationHello.
Can I somehow aggregate DCI values? I have created DCI's for OpenVPN users count on several servers, and now I would like to see the total users count.
I read wiki and saw there a script "Aggregation of DCI values and applying the 95% percentile average". I've written similar script for OpenVPN users count, saved it in Script Library, but I don't know where and how to apply it. -
Threshold issueThank you. It worked.
-
Threshold issueHello!
I have configured CPU temperature monitoring with ExternalParameter = CPU.Temperature(*):/usr/bin/sensors|egrep 'Core\s*$1' | cut -d+ -f2 | cut -d. -f1
It gives me the integer part of the core temperature. I've added return int32($1) to the transformation
I can build graphs based on this values, but when I try to generate alarm based on threshold "> : greater then" it is not working.
I suppose, despite the transformation, it processes the value as string, because "like/not like" thresholds seems to be working.
What can be done about this issue?Any help appreciated!
-
FileSystem.* and LVMThank you. It worked like a charm.
-
FileSystem.* and LVMI have a trouble with configuring DCI with FileSystem.Total/Free/etc and LVM on my Ubuntu 12.04 server.
In case of simple physical disk I would use /dev/sda, but what should I use with LVM?
I've tried FileSystem.Free(/dev/SysVolGroup/root) but that's doesn't seem to be working.NetXMS server and agent versions are 1.2.4
-
Ошибка СегметированияСпасибо большое, обновление до 1.0.12-rc решило проблему.
-
Ошибка СегметированияВот вывод:
(gdb) bt
#0 Node::deleteInterface (this=0x93f93f0, pInterface=0x9514248) at node.cpp:927
#1 0xb7ee44bb in Node::updateInterfaceConfiguration (this=0x93f93f0, dwRqId=0, dwNetMask=0) at node.cpp:1787
#2 0xb7ee5927 in Node::configurationPoll (this=0x93f93f0, pSession=0x0, dwRqId=0, nPoller=14, dwNetMask=0)
at node.cpp:1647
#3 0xb7ef3002 in ConfigurationPoller (arg=0xe) at poll.cpp:307
#4 0xb7ce096e in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
#5 0xb7b12a4e in clone () from /lib/tls/i686/cmov/libc.so.6