PRTG / PRTGScheduler

With PRTG Scheduler, you can configure customized maintenance windows for every PRTG object (Sensors, Devices, and Groups). It allows for various ways of occurrences, like every first Sunday in January, February and March, or only the first week of every month.
MIT License
15 stars 1 forks source link

Does PRTGScheduler work with the new webinterface (17.4.35 and later)? #12

Closed stephanlinke closed 6 years ago

stephanlinke commented 6 years ago

In this version, the javascript files have changed and the models are currently targeting the old javascript files. Please make the following changes in order for the menu entries to appear:

application/models/Maintenance_model.php, line 438:

$jsCustomFile = file_get_contents("C:\Program Files (x86)\PRTG Network Monitor\webroot\javascript\scripts_custom_v2.js");

application/models/Maintenance_model.php, line 444:

file_put_contents("C:\Program Files (x86)\PRTG Network Monitor\webroot\javascript\scripts_custom_v2.js",$jsCustomFile);

deejey01 commented 6 years ago

I made the the changes but still no maintenance report in the menu.

image

# Add the entry to Reports > System Reports public function checkPrtgMenu() { $jsCustomFile = file_get_contents("C:\Program Files (x86)\PRTG Network Monitor\webroot\javascript\scripts_custom_v2.js"); $pattern ="/(\/\/.PRTG.Scheduler.menu.entry)/"; $line = "$('#main_menu > li:nth-child(7) > ul > li:nth-child(4) > ul > li:nth-child(3)').after('<li><a href=\"/config_report_maintenances.htm\" class=\"nohjax\" target=\"_blank\">".$this->lang->line('menu_entry')."</a></li>'); // PRTG Scheduler menu entry"; if(!(preg_match($pattern,$jsCustomFile))){ $this->log('Writing Maintenance Windows menu entry',1); $jsCustomFile .= PHP_EOL.$line; file_put_contents("C:\Program Files (x86)\PRTG Network Monitor\webroot\javascript\scripts_custom_v2.js",$jsCustomFile); } }

The scripts_custom_v2.js is on the right location.

stephanlinke commented 6 years ago

And does it contain the menu entry? It actually only updates when the sensor executes - strange. You could also add the following manually: $('#main_menu > li:nth-child(7) > ul > li:nth-child(4) > ul > li:nth-child(3)').after('<li><a href=\"/config_report_maintenances.htm\" class=\"nohjax\" target=\"_blank\">".$this->lang->line('menu_entry')."</a></li>'); // PRTG Scheduler menu entry

deejey01 commented 6 years ago

Strange, yesterday I ran the scheduler sensor a few times and nothing happens. Today I see the report entry.

image

stephanlinke commented 6 years ago

Great! :) Closing issue.

sbradley-cjd commented 6 years ago

Hi Stephan,

Having same issue, report not coming up in menu. Installed as per instructions, devices are going into paused state as they should, and coming back. But no report in the menu. Added the line directly into the scripts_custom_v2.js file, and after that the javascript menu's stopped responding (copied and pasted from above).

On version 18.2.39.1661.

regards Shaun

stephanlinke commented 6 years ago

Sorry, I totally missed that one :/ Could you post the complete content of your scripts_custom_v2.js, please?

sbradley-cjd commented 6 years ago

Currently it has nothing in it, just the comments... / // You can use this file to modify the appearance of the PRTG web interface // as described in https://kb.paessler.com/en/topic/33 //
// Please note that you are using an unsupported and deprecated feature. // Your changes will be broken or removed with future PRTG updates. //
// If you modify this file, PLEASE LET US KNOW what you're changing and why! // Just drop an email to support@paessler.com and help us understand your // needs. Thank you!
/

When I tried to add the line manually at the end, as other's did above, the menu's stopped responding in the PRTG interface, so I undid it. In light of the comments above, does it still work in the 18.2.39.1661 x64 version, which is what we are still running? Unless I copied and pasted some wrong characters somehow.

Please note was using Chrome browser in Windows 10 if that makes any difference

I can run the report directly by typing in the URL, so it's not the end of the world if it doesn't work, but it's a nice to have :)

mafer0410 commented 4 years ago

hello, where is the maintenance status configured?