Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - rostyslav

#1
General Support / Re: Reports... again
May 12, 2014, 11:39:39 AM
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
#2
cat /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

#3
The gdb output is attached.
#4
I don't know if this is the same issue, but nxagentd still doesn't start after upgrade. nxagent -D9 in the attachment. My system is Ubuntu 12.04.
#5
Same problem here. OS: Ubuntu 12.04
#6
General Support / NetXMS cluster configuration
February 14, 2013, 05:47:53 PM
Just 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).
1. 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.
2. 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)# quit


And that's all. You have working NetXMS cluster now.
#7
General Support / Reports... again
January 17, 2013, 04:57:01 PM
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):
1. 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

2. 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

3. Edit pom.xml to remove unnecessary dependencies:
cd ./svn.netxms.org/public/netxms/trunk/src/java/report-generator/
nano pom.xml

4. 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/

5. 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/netxms


Steps to actually generate reports:
1. Download script (xml-generation.pl, createMainXML.pm, createSubReport.pm)
2. Install perl
3. 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)
4. Run the xml-generation.pl script. It will generate subreports named <node_name>-<description>-<interval>.jrxml and main report named <interval>.jrxml
5. 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"
6. 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"
7. 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
#8
General Support / Re: Reports
January 10, 2013, 11:47:28 AM
Because 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
#9
General Support / Re: Reports
January 09, 2013, 11:50:24 AM
I'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
value


object_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
#10
General Support / Re: Reports
January 08, 2013, 05:07:27 PM
Alex, 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
#11
General Support / Reports
December 25, 2012, 12:11:25 PM
I 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%20Inventory.jrxml and imported it to the NetXMS server.
Then compiled report-generator.jar
apt-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/netxms


But reports not generating.
Thanks for any help.
#12
General Support / Re: DCI Error issue
December 12, 2012, 12:37:33 PM
There is no history.
#13
General Support / DCI Error issue
December 12, 2012, 11:14:45 AM
Hello,

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;
}
#14
General Support / DCI Aggregation
December 07, 2012, 11:20:44 AM
Hello.

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.
#15
General Support / Re: Threshold issue
December 07, 2012, 11:15:10 AM
Thank you. It worked.