Discussion:
[Check_mk (english)] Monitoring cron jobs scheduled by other users
Praveen Kumar Velpula
2018-11-05 10:35:58 UTC
Permalink
Hi Team,

We are trying to monitor cron job scheduled by other user. However we are
able to monitor the cron jobs created by root.

Could you please help me in how to monitor the cron jobs created by other
users.

Thanks in advance.

Best regards,
Praveen.
Robert Sander
2018-11-05 11:17:52 UTC
Permalink
Post by Praveen Kumar Velpula
Hi Team,
We are trying to monitor cron job scheduled by other user. However we are able to monitor the cron jobs created by root.
Do you mean monitoring with mk-job?

You need to create directories in /var/lib/check_mk_agent/job/
named after the user and owned by the user scheduling the job.

You can test it by running

/usr/bin/mk-job test /bin/true

as the user in question.

Regards
--
Robert Sander
Heinlein Support GmbH
Schwedter Str. 8/9b, 10119 Berlin

https://www.heinlein-support.de

Tel: 030 / 405051-43
Fax: 030 / 405051-19

Amtsgericht Berlin-Charlottenburg - HRB 93818 B
GeschÀftsfÌhrer: Peer Heinlein - Sitz: Berlin
Praveen Kumar Velpula
2018-11-09 11:43:29 UTC
Permalink
Thanks Robert.

We have followed the steps that you have given us, however we are still not
able to see the jobs generated by normal user other than root.

We just see the test job that we execute to verify.

Is there anything we are missing here ?

Thanks in advance.

Best regards,
Praveen.
Post by Praveen Kumar Velpula
Post by Praveen Kumar Velpula
Hi Team,
We are trying to monitor cron job scheduled by other user. However we
are able to monitor the cron jobs created by root.
Do you mean monitoring with mk-job?
You need to create directories in /var/lib/check_mk_agent/job/
named after the user and owned by the user scheduling the job.
You can test it by running
/usr/bin/mk-job test /bin/true
as the user in question.
Regards
--
Robert Sander
Heinlein Support GmbH
Schwedter Str. 8/9b, 10119 Berlin
https://www.heinlein-support.de
Tel: 030 / 405051-43
Fax: 030 / 405051-19
Amtsgericht Berlin-Charlottenburg - HRB 93818 B
GeschÀftsfÌhrer: Peer Heinlein - Sitz: Berlin
_______________________________________________
checkmk-en mailing list
Manage your subscription or unsubscribe
http://lists.mathias-kettner.de/mailman/listinfo/checkmk-en
Robert Sander
2018-11-09 12:07:57 UTC
Permalink
We have followed the steps that you have given us, however we are still not able to see the jobs generated by normal user other than root.
/usr/bin/mk-job test /bin/true
Have you prefixed your other jobs with mk-job?
Is there any error message in cron's log or somewhere else?

Regards
--
Robert Sander
Heinlein Support GmbH
Schwedter Str. 8/9b, 10119 Berlin

https://www.heinlein-support.de

Tel: 030 / 405051-43
Fax: 030 / 405051-19

Amtsgericht Berlin-Charlottenburg - HRB 93818 B
GeschÀftsfÌhrer: Peer Heinlein - Sitz: Berlin
Rajesh Avu via checkmk-en
2018-11-09 16:03:28 UTC
Permalink
Hi Robert,
Yes we have mentioned the prefix 'mk-job' to the cron job.also there is no errors observed in cron log or any where else. Job is running successfully. 
We even tested the job scheduled with the command you suggested/usr/bin/mk-job test /bin/true

it has created a check with the name "Job test" with the time when we ran the command. and showing the same time as an when the command is executed for testing. Attaching snip for your reference.
We have followed the steps that you have given us, however we are still not able to see the jobs generated by normal user other than root.
    /usr/bin/mk-job test /bin/true
Have you prefixed your other jobs with mk-job?
Is there any error message in cron's log or somewhere else?

Regards
--
Robert Sander
Heinlein Support GmbH
Schwedter Str. 8/9b, 10119 Berlin

https://www.heinlein-support.de

Tel: 030 / 405051-43
Fax: 030 / 405051-19

Amtsgericht Berlin-Charlottenburg - HRB 93818 B
GeschÀftsfÌhrer: Peer Heinlein - Sitz: Berlin
Robert Sander
2018-11-10 15:07:51 UTC
Permalink
Post by Rajesh Avu via checkmk-en
Yes we have mentioned the prefix 'mk-job' to the cron job.
also there is no errors observed in cron log or any where else. Job is
running successfully. 
Can you please send the complete line from the crontab entry?

Regard
--
Robert Sander
Heinlein Support GmbH
Schwedter Str. 8/9b, 10119 Berlin

http://www.heinlein-support.de

Tel: 030 / 405051-43
Fax: 030 / 405051-19

Zwangsangaben lt. §35a GmbHG:
HRB 93818 B / Amtsgericht Berlin-Charlottenburg,
GeschÀftsfÌhrer: Peer Heinlein -- Sitz: Berlin
Rajesh Avu via checkmk-en
2018-11-10 15:38:07 UTC
Permalink
Hi Robert,
PFA details for the cronjob
crontab entry:42 16 * * * mk-job mysql_cron /opt/apps/x/y/z/automysqlbackup /opt/apps/a/b/c/MySQLInstance3346.conf
also created the folder with user name "mysql"[***@xxxxxxxx Mysql 8.0 mysql]$ pwd                                                                                     /var/lib/check_mk_agent/job/mysql[***@xxxxxxxx Mysql 8.0 mysql]$ ll                                                                                      total 0

Thanks & Regards,Rajesh Avu
Post by Rajesh Avu via checkmk-en
Yes we have mentioned the prefix 'mk-job' to the cron job.
also there is no errors observed in cron log or any where else. Job is
running successfully. 
Can you please send the complete line from the crontab entry?

Regard
--
Robert Sander
Heinlein Support GmbH
Schwedter Str. 8/9b, 10119 Berlin

http://www.heinlein-support.de

Tel: 030 / 405051-43
Fax: 030 / 405051-19

Zwangsangaben lt. §35a GmbHG:
HRB 93818 B / Amtsgericht Berlin-Charlottenburg,
GeschÀftsfÌhrer: Peer Heinlein -- Sitz: Berlin
Robert Sander
2018-11-10 17:42:07 UTC
Permalink
Post by Rajesh Avu via checkmk-en
42 16 * * * mk-job mysql_cron /opt/apps/x/y/z/automysqlbackup
/opt/apps/a/b/c/MySQLInstance3346.conf
Is this crontab from the mysql user?
Post by Rajesh Avu via checkmk-en
also created the folder with user name "mysql"
                                                 
/var/lib/check_mk_agent/job/mysql
Is this folder owned (writable) by the mysql user?

Regards
--
Robert Sander
Heinlein Support GmbH
Schwedter Str. 8/9b, 10119 Berlin

http://www.heinlein-support.de

Tel: 030 / 405051-43
Fax: 030 / 405051-19

Zwangsangaben lt. §35a GmbHG:
HRB 93818 B / Amtsgericht Berlin-Charlottenburg,
GeschÀftsfÌhrer: Peer Heinlein -- Sitz: Berlin
Rajesh Avu via checkmk-en
2018-11-11 08:30:05 UTC
Permalink
Hi Robert,
yes, the crontab scheduled from mysql user.
and you are correct, we missed a simple logic here. mysql user doesn't have the write permissions on the folder. I have given permissions to mysql user now and tested the backup thrice. It is working fine. 
Thanks for your valuable time suggestions :) 
Post by Rajesh Avu via checkmk-en
42 16 * * * mk-job mysql_cron /opt/apps/x/y/z/automysqlbackup
/opt/apps/a/b/c/MySQLInstance3346.conf
Is this crontab from the mysql user?
Post by Rajesh Avu via checkmk-en
also created the folder with user name "mysql"
                                                 
/var/lib/check_mk_agent/job/mysql
Is this folder owned (writable) by the mysql user?

Regards
--
Robert Sander
Heinlein Support GmbH
Schwedter Str. 8/9b, 10119 Berlin

http://www.heinlein-support.de

Tel: 030 / 405051-43
Fax: 030 / 405051-19

Zwangsangaben lt. §35a GmbHG:
HRB 93818 B / Amtsgericht Berlin-Charlottenburg,
GeschÀftsfÌhrer: Peer Heinlein -- Sitz: Berlin
Loading...