Page 1 of 1
Scheduled reports management
Posted: Wed Feb 02, 2022 3:01 am
by lvaillant
Hello,
Is there a way to list the all the scheduled reports created by users ?
The idea is to be able to view the current schedule and help users to schedule them at different times to avoid load on server.
Thank you.
Nagios 5.8.7 / RHEL 7.4
Re: Scheduled reports management
Posted: Wed Feb 02, 2022 8:37 pm
by ssax
The easiest way I've found is to look in
/var/spool/cron/apache and correlate them.
I wrote this to parse them from the DB as well:
Code: Select all
<?php
$dbserver = '127.0.0.1';
$dbname = 'nagiosxi';
$username = 'nagiosxi';
$password = 'n@gweb';
try {
$conn = new PDO("mysql:host=$dbserver;dbname=$dbname;charset=utf8mb4","$username","$password");
// set the PDO error mode to exception
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
echo "Connected successfully\n";
$sql = "SELECT xi_users.username, xi_usermeta.keyvalue FROM xi_usermeta LEFT JOIN xi_users ON xi_users.user_id = xi_usermeta.user_id WHERE xi_usermeta.keyname = 'scheduled_reports'";
foreach ($conn->query($sql) as $row) {
var_dump(unserialize($row['keyvalue']));
}
} catch (PDOException $e) {
echo "Connection failed: " . $e->getMessage();
exit(3);
}
?>
Put it into a file and call it like this:
Re: Scheduled reports management
Posted: Tue Feb 08, 2022 5:36 am
by lvaillant
Hello,
Thank you!
Both solutions work well
This case can be considered as solved.
Re: Scheduled reports management
Posted: Tue Feb 08, 2022 7:18 pm
by ssax
Great, thanks for the update! Locking and marking as resolved.
Thank you!