How to automatically generate scheduled reports entries?

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
lvaillant
Posts: 57
Joined: Mon Jun 06, 2016 2:47 am
Location: Paris, France

How to automatically generate scheduled reports entries?

Post by lvaillant »

Hello,

Still working on my "scheduled reports" topic, I'm looking at a solution to create around 100 scheduled reports without using the web GUI.

In a previous topic, I found a SQL request to display existing reports:

Code: Select all

echo "select * from xi_usermeta where keyname = 'scheduled_reports';;" | mysql -uroot -pnagiosxi nagiosxi
Is there some documentation available that describes the format of each report?
I would like to automate the creation of the expected reports.

The format is quite understandable, but I'd appreciate to have a more official way of managing this than reverse engineering.

Thank you
Loïc VAILLANT
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: How to automatically generate scheduled reports entries?

Post by scottwilkerson »

lvaillant wrote: Is there some documentation available that describes the format of each report?
We do not have any documentation on individual reports as we don't manyally construct the serialized array you are looking at

The changes for different reports basically all get injected in the url field you have likely seen.

The only other think that I know of worth explaining is that a few reports have csv available as attachments, but the rest just have pdf or jpg
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
lvaillant
Posts: 57
Joined: Mon Jun 06, 2016 2:47 am
Location: Paris, France

Re: How to automatically generate scheduled reports entries?

Post by lvaillant »

scottwilkerson wrote:We do not have any documentation on individual reports as we don't manyally construct the serialized array you are looking at

The changes for different reports basically all get injected in the url field you have likely seen.
The difficult part is to identify the potential algorithm to generate the report ID (randow 6-car string?) and to determine the int value associated to the 'a' attribute (item/tuple count?).
  • The 's' attribute identifies a string, followed by the length of the related string : s:4:"1234"
  • The 'i' attribute is an integer: s:11:"dontdisplay";i:0;
scottwilkerson wrote:The only other think that I know of worth explaining is that a few reports have csv available as attachments, but the rest just have pdf or jpg
I need CVS attachements :)
But it's easy to add

Code: Select all

	s:11:"attachments";a:1:{
		s:7:"csvhost";s:2:"on";
	}
Loïc VAILLANT
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: How to automatically generate scheduled reports entries?

Post by scottwilkerson »

lvaillant wrote:The difficult part is to identify the potential algorithm to generate the report ID (randow 6-car string?)
Yes, but must be unique.
lvaillant wrote:and to determine the int value associated to the 'a' attribute (item/tuple count?).
Yes, this is the count of attachments.

Not sure if you develop in php at all but this whole item can be grabbed from the database and passed to unserialize() and it will become an array.

Then after you modify the array, pass to serialize() and it will be converted to this string to put in the DB again.

This eliminates counting string lengths etc, this all happens automatically
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
lvaillant
Posts: 57
Joined: Mon Jun 06, 2016 2:47 am
Location: Paris, France

Re: How to automatically generate scheduled reports entries?

Post by lvaillant »

Hello.

Thank you.
You can close this thread.
Loïc VAILLANT
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: How to automatically generate scheduled reports entries?

Post by scottwilkerson »

Glad to hear it is resolved.

Locking
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked