Import Zabbix Template XML format using Python Scripts

Recently i was working on automation project for Zabbix, The idea of the project is automate the template change on multiple sites instead of doing this manually, these scripts will do the import for you, and you can import more than one template With format XML into the Zabbix server, the export script will be uploaded soon.

I Upload the scripts to my GitHub Here

Enjoy the Zabbix

Osama

Linux – Bash Scripts to help monitoring your system

This week, i was working on Automation Project related to Zabbix, which is fix the issues automatically without human interaction, so in case for example; the file system alert reach 85% it will be delete specific folder and send an email to system administrator.

or for example the Cache has been filled and you need to clear, so need for example for someone to access the server and take an action to do this.

I wrote scripts where it’s integrate it with Zabbix and once the threshold will fire, the scripts will run automatically.

This github repository will be updated since the project is not complete yet, still has to do a lot of scripting and integration but i would like to share it with you guys.

The scripts uploaded to my Github here

Enjoy

Osama

Dealing with s3 using Python – Boto3 Module – Upload/Download files from bucket

We all know Amazon AWS, one of the AWS Features called s3, refer to Simple Storage Service which is is a service offered by Amazon Web Services that provides object storage through a web service interface.

Amazon Provide different ways to deal with s3, either by console or by AWSCLI, But In this post i choose to work with s3 in different way, as most of you know, i love python because it’s very simple, not complicated and cross-platform programming language.

You can deal and manage s3 using python by module called boto3, in previous version it was called boto (without 3), you have to install this module to allow python import the library, very simple step

pip3 install boto3

or by the project Interpreter that you are using, in my case i am using PyCharm Community, Nice to deal with, you can install any module by doing the following

File --> Setting --> Project interpreter --> Press on + sign --> and search for the module you want to install 

I uploaded the scripts to my Github like usual here, the repository includes two different file

  • Upload to S3
  • Download from s3

It’s very simple scripts, but you have to update the following to ensure access to AWS S3

Inside the upload file S3

  • ACCESS_KEY_ID
  • ACCESS_SECRET_KEY
  • BUCKET_NAME
  • The Location of the files

Inside the download from S3 file

  • ACCESS_KEY_ID
  • ACCESS_SECRET_KEY
  • BUCKET_NAME

Cheers ✌😉

Osama

Coding with Python

Python is a powerful high-level, object-oriented programming language created by Guido van Rossum.

It has simple easy-to-use syntax, making it the perfect language for someone trying to learn computer programming for the first time.

I Will keep working frequtely on this part and this programing langyage since i am using it on daily basis for different things such as Analytics, Scripting and Devops, for simple, easy to learn and more than this powerful.

For the begginers and people who wants simple code and examples i uploaded code samples on my github Press on the icon below.

icons8-github-50

 

Thank you

Osama

privileges Scripts

These script made by René Nyffenegger and shared here for knowledge

List user role and privileges :

select
lpad(' ', 2*level) || granted_role "User, his roles and privileges"
from
(
/* THE USERS */
select
null grantee,
username granted_role
from
dba_users
where
username like upper('%&enter_username%')
/* THE ROLES TO ROLES RELATIONS */
union
select
grantee,
granted_role
from
dba_role_privs
/* THE ROLES TO PRIVILEGE RELATIONS */
union
select
grantee,
privilege
from
dba_sys_privs
)
start with grantee is null
connect by grantee = prior granted_role;

Check System privileges:

select
lpad(' ', 2*level) || c "Privilege, Roles and Users"
from
(
/* THE PRIVILEGES */
select
null p,
name c
from
system_privilege_map
where
name like upper('%&enter_privliege%')
/* THE ROLES TO ROLES RELATIONS */
union
select
granted_role p,
grantee c
from
dba_role_privs
/* THE ROLES TO PRIVILEGE RELATIONS */
union
select
privilege p,
grantee c
from
dba_sys_privs
)
start with p is null
connect by p = prior c;

Object Privileges :

select
case when level = 1 then own || '.' || obj || ' (' || typ || ')' else
lpad (' ', 2*(level-1)) || obj || nvl2 (typ, ' (' || typ || ')', null)
end
from
(
/* THE OBJECTS */
select
null p1,
null p2,
object_name obj,
owner own,
object_type typ
from
dba_objects
where
owner not in
('SYS', 'SYSTEM', 'WMSYS', 'SYSMAN','MDSYS','ORDSYS','XDB', 'WKSYS', 'EXFSYS',
'OLAPSYS', 'DBSNMP', 'DMSYS','CTXSYS','WK_TEST', 'ORDPLUGINS', 'OUTLN')
and object_type not in ('SYNONYM', 'INDEX')
/* THE OBJECT TO PRIVILEGE RELATIONS */
union
select
table_name p1,
owner p2,
grantee,
grantee,
privilege
from
dba_tab_privs
/* THE ROLES TO ROLES/USERS RELATIONS */
union
select
granted_role p1,
granted_role p2,
grantee,
grantee,
null
from
dba_role_privs
)
start with p1 is null and p2 is null
connect by p1 = prior obj and p2 = prior own;
 
 Thank you 
Osama Mustafa 

DBA Scripts / Part No.4

This Is new Scripts for Database Administrator , But this Scripts to Check Performance and helping you in Tuning :

1-Script_1 . (Active Session/Execution Plan/Oracle 9i)
2-Script_2 (Active Session/Execution Plan / Any Version).
3-Script_3 (Plan History).
4-Script_4 (Number Of sesion).

Done & Enjoy

Osama Mustafa