|
1 |
| -# system-info |
| 1 | +# INTRODUCTION: |
2 | 2 | Cross-platform scripts developed in Python3 for fetching and providing runtime CPU, RAM, PIDs, OS and system information.
|
3 | 3 |
|
4 |
| -NOTE: Currently in development phase! |
| 4 | +### Audience: |
| 5 | +Quite simply, everyone. From a student to a system engineer, from a software developer to an IT enthusiast. It's developed with the thought to be easily used by anyone :wink: . |
| 6 | + |
| 7 | +# Pre-requisites: |
| 8 | +1. **Python3** |
| 9 | + * Python 3 is easily available for free to download, install and use on windows & *nix platforms. If you do not have Python 3 installed on your machine where you require the use or execution of these scripts, please feel free to use the following methods: |
| 10 | + |
| 11 | + * **Windows**: [Python3.7.0](https://www.python.org/downloads/release/python-370/) is the latest major Python release that can easily be downloaded and installed. _Note:_ Python 3.7.0 was the major release at the point of this development. Feel free to use a newer 3.x Python version if you desire. |
| 12 | + |
| 13 | + * **Ubuntu LTS OS's**: Pre-installed on Ubuntu LTS OS's i.e. 16.04 xenial & 18.04 bionic. |
| 14 | + |
| 15 | +2. **`psutil`** library |
| 16 | + |
| 17 | + * **Windows**: You can easily install psutil library using command prompt i.e. cmd. Just open cmd, and type in `pip install psutil` . |
| 18 | + |
| 19 | + * **Ubuntu LTS OS's**: Just run the [install_pre-reqs.sh]() script and it will take care of that for you. |
| 20 | + |
| 21 | + * **Note:** [psutil](https://github.com/giampaolo/psutil) library was developed by [Giampaolo Rodola](https://github.com/giampaolo). It is a cross platform library for system level information. Kudos to Giampaolo !!! |
| 22 | + |
| 23 | +# Tested on: |
| 24 | +1. Windows Operating Systems (i.e. 7, 8, 8.x & 10). Works on Windows Server editions too. |
| 25 | + |
| 26 | +2. Ubuntu 16.04 & Ubuntu 18.04 |
| 27 | + |
| 28 | + |
| 29 | + |
| 30 | +# Usage: |
| 31 | + |
| 32 | +Utilizing the library is pretty simple. All you need to do is execute the `main_system.py` file. Assuming that you have already downloaded either the zip/tar or cloned the project already. Following two sections will cover the execution process. |
| 33 | + |
| 34 | + * #### Windows: |
| 35 | + 1. Open a `cmd` window. |
| 36 | + 2. Perform `cd` into the directory where the extracted archive or project is cloned in. For instance, if you have extracted or cloned into D:\ drive. Do `cd D:\system-info` |
| 37 | + 3. Now, change directory into the `sysinfo` package i.e. `cd sysinfo` |
| 38 | + 4. Current directory should be: **D:\system-info\sysinfo** |
| 39 | + 5. Execute `main_system.py` with the following commands: `python main_system.py` |
| 40 | + 6. All done. That will print a detailed output as can be seen below: |
| 41 | + ```batch |
| 42 | + D:\system-info\sysinfo>python main_system.py |
| 43 | + |
| 44 | + System & OS level details below: |
| 45 | + |
| 46 | + OS Type: Windows |
| 47 | + OS Release version: 10 |
| 48 | + Processor Name: Intel64 Family 6 Model 78 Stepping 3, GenuineIntel |
| 49 | + Machine Name on Network is: DESKTOP-MS0CV80 |
| 50 | + Machine Type is: AMD64 |
| 51 | + System platform type is: win32 |
| 52 | + |
| 53 | + RAM details below: |
| 54 | + |
| 55 | + Total memory is: 8481.492992 MBs |
| 56 | + Current available memory is: 1897.357312 MBs |
| 57 | + Current used memory is: 6584.13568 MBs |
| 58 | + Percentage of RAM being utilized currently: 77.6% |
| 59 | + |
| 60 | + Current process details below: |
| 61 | + {'pid': 0, 'name': 'System Idle Process', 'username': 'NT AUTHORITY\\SYSTEM'} |
| 62 | + {'pid': 4, 'name': 'System', 'username': 'NT AUTHORITY\\SYSTEM'} |
| 63 | + {'pid': 96, 'name': 'Registry', 'username': None} |
| 64 | + {'pid': 3268, 'name': 'SkypeHost.exe', 'username': 'DESKTOP-MS0CV80\\User'} |
| 65 | + {'pid': 3600, 'name': 'vmware-authd.exe', 'username': None} |
| 66 | + {'pid': 3672, 'name': 'svchost.exe', 'username': None} |
| 67 | + {'pid': 3688, 'name': 'RuntimeBroker.exe', 'username': 'DESKTOP-MS0CV80\\User'} |
| 68 | + {'pid': 3804, 'name': 'chrome.exe', 'username': 'DESKTOP-MS0CV80\\User'} |
| 69 | + {'pid': 3872, 'name': 'valWBFPolicyService.exe', 'username': None} |
| 70 | + {'pid': 3888, 'name': 'vmware-usbarbitrator64.exe', 'username': None} |
| 71 | + {'pid': 4208, 'name': 'MsMpEng.exe', 'username': None} |
| 72 | + {'pid': 8884, 'name': 'vmware-tray.exe', 'username': 'DESKTOP-MS0CV80\\User'} |
| 73 | + |
| 74 | + D:\system-info\sysinfo> |
| 75 | + ``` |
| 76 | + |
| 77 | + |
| 78 | + * #### Ubuntu: |
| 79 | + 1. Change to user's home directory, for e.g. by entering the following command: `cd ~` |
| 80 | + 2. Either Download using `wget ` or clone using `git clone https://github.com/Tech-Overlord/system-info` |
| 81 | + 3. If cloned, simply change into the root directory of the cloned project. |
| 82 | + 4. Do `chmod +x ~/system-info/sysinfo/*` |
| 83 | + 5. Execute **main_system.py** file with the command: `python3 main_system.py` |
| 84 | + 6. This will print a detailed output as shown below: |
| 85 | + ```shell |
| 86 | + vagrant@ubuntu:/vagrant/sysinfo$ python3 main_system.py |
| 87 | + |
| 88 | + System & OS level details below: |
| 89 | + |
| 90 | + OS Type: Linux |
| 91 | + OS Release version: 4.4.0-131-generic |
| 92 | + Processor Name: x86_64 |
| 93 | + Machine Name on Network is: ubuntu |
| 94 | + Machine Type is: x86_64 |
| 95 | + System platform type is: linux |
| 96 | + |
| 97 | + RAM details below: |
| 98 | + |
| 99 | + Total memory is: 1040.22016 MBs |
| 100 | + Current available memory is: 667.090944 MBs |
| 101 | + Current used memory is: 117.047296 MBs |
| 102 | + Percentage of RAM being utilized currently: 25.2% |
| 103 | + |
| 104 | + Current process details below: |
| 105 | + |
| 106 | + {'pid': 1, 'name': 'systemd', 'username': 'root'} |
| 107 | + {'pid': 2, 'name': 'kthreadd', 'username': 'root'} |
| 108 | + {'pid': 3, 'name': 'ksoftirqd/0', 'username': 'root'} |
| 109 | + {'pid': 4, 'name': 'kworker/0:0', 'username': 'root'} |
| 110 | + {'pid': 5, 'name': 'kworker/0:0H', 'username': 'root'} |
| 111 | + {'pid': 6, 'name': 'kworker/u4:0', 'username': 'root'} |
| 112 | + {'pid': 7, 'name': 'rcu_sched', 'username': 'root'} |
| 113 | + {'pid': 8, 'name': 'rcu_bh', 'username': 'root'} |
| 114 | + {'pid': 9, 'name': 'migration/0', 'username': 'root'} |
| 115 | + {'pid': 10, 'name': 'watchdog/0', 'username': 'root'} |
| 116 | + {'pid': 11, 'name': 'watchdog/1', 'username': 'root'} |
| 117 | + {'pid': 12, 'name': 'migration/1', 'username': 'root'} |
| 118 | + {'pid': 13, 'name': 'ksoftirqd/1', 'username': 'root'} |
| 119 | + {'pid': 14, 'name': 'kworker/1:0', 'username': 'root'} |
| 120 | + {'pid': 15, 'name': 'kworker/1:0H', 'username': 'root'} |
| 121 | + {'pid': 16, 'name': 'kdevtmpfs', 'username': 'root'} |
| 122 | + {'pid': 17, 'name': 'netns', 'username': 'root'} |
| 123 | + {'pid': 18, 'name': 'perf', 'username': 'root'} |
| 124 | + {'pid': 19, 'name': 'khungtaskd', 'username': 'root'} |
| 125 | + {'pid': 20, 'name': 'writeback', 'username': 'root'} |
| 126 | + {'pid': 21, 'name': 'ksmd', 'username': 'root'} |
| 127 | + {'pid': 22, 'name': 'khugepaged', 'username': 'root'} |
| 128 | + {'pid': 23, 'name': 'crypto', 'username': 'root'} |
| 129 | + {'pid': 24, 'name': 'kintegrityd', 'username': 'root'} |
| 130 | + {'pid': 25, 'name': 'bioset', 'username': 'root'} |
| 131 | + {'pid': 26, 'name': 'kblockd', 'username': 'root'} |
| 132 | + {'pid': 27, 'name': 'ata_sff', 'username': 'root'} |
| 133 | + {'pid': 28, 'name': 'md', 'username': 'root'} |
| 134 | + {'pid': 29, 'name': 'devfreq_wq', 'username': 'root'} |
| 135 | + {'pid': 30, 'name': 'kworker/u4:1', 'username': 'root'} |
| 136 | + {'pid': 31, 'name': 'kworker/0:1', 'username': 'root'} |
| 137 | + {'pid': 32, 'name': 'kworker/1:1', 'username': 'root'} |
| 138 | + {'pid': 34, 'name': 'kswapd0', 'username': 'root'} |
| 139 | + {'pid': 35, 'name': 'vmstat', 'username': 'root'} |
| 140 | + {'pid': 36, 'name': 'fsnotify_mark', 'username': 'root'} |
| 141 | + {'pid': 37, 'name': 'ecryptfs-kthrea', 'username': 'root'} |
| 142 | + {'pid': 53, 'name': 'kthrotld', 'username': 'root'} |
| 143 | + {'pid': 54, 'name': 'acpi_thermal_pm', 'username': 'root'} |
| 144 | + {'pid': 55, 'name': 'kworker/u4:2', 'username': 'root'} |
| 145 | + {'pid': 56, 'name': 'bioset', 'username': 'root'} |
| 146 | + {'pid': 57, 'name': 'bioset', 'username': 'root'} |
| 147 | + {'pid': 58, 'name': 'bioset', 'username': 'root'} |
| 148 | + {'pid': 59, 'name': 'bioset', 'username': 'root'} |
| 149 | + {'pid': 60, 'name': 'bioset', 'username': 'root'} |
| 150 | + {'pid': 61, 'name': 'bioset', 'username': 'root'} |
| 151 | + {'pid': 62, 'name': 'bioset', 'username': 'root'} |
| 152 | + {'pid': 63, 'name': 'bioset', 'username': 'root'} |
| 153 | + {'pid': 64, 'name': 'scsi_eh_0', 'username': 'root'} |
| 154 | + {'pid': 65, 'name': 'scsi_tmf_0', 'username': 'root'} |
| 155 | + {'pid': 66, 'name': 'scsi_eh_1', 'username': 'root'} |
| 156 | + {'pid': 67, 'name': 'scsi_tmf_1', 'username': 'root'} |
| 157 | + {'pid': 68, 'name': 'kworker/u4:3', 'username': 'root'} |
| 158 | + {'pid': 72, 'name': 'ipv6_addrconf', 'username': 'root'} |
| 159 | + {'pid': 85, 'name': 'deferwq', 'username': 'root'} |
| 160 | + {'pid': 86, 'name': 'charger_manager', 'username': 'root'} |
| 161 | + {'pid': 125, 'name': 'kpsmoused', 'username': 'root'} |
| 162 | + {'pid': 126, 'name': 'kworker/1:2', 'username': 'root'} |
| 163 | + {'pid': 152, 'name': 'mpt_poll_0', 'username': 'root'} |
| 164 | + {'pid': 153, 'name': 'mpt/0', 'username': 'root'} |
| 165 | + {'pid': 154, 'name': 'scsi_eh_2', 'username': 'root'} |
| 166 | + {'pid': 155, 'name': 'scsi_tmf_2', 'username': 'root'} |
| 167 | + {'pid': 156, 'name': 'bioset', 'username': 'root'} |
| 168 | + {'pid': 157, 'name': 'bioset', 'username': 'root'} |
| 169 | + {'pid': 186, 'name': 'kworker/u4:4', 'username': 'root'} |
| 170 | + {'pid': 259, 'name': 'raid5wq', 'username': 'root'} |
| 171 | + {'pid': 285, 'name': 'bioset', 'username': 'root'} |
| 172 | + {'pid': 315, 'name': 'jbd2/sda1-8', 'username': 'root'} |
| 173 | + {'pid': 316, 'name': 'ext4-rsv-conver', 'username': 'root'} |
| 174 | + {'pid': 372, 'name': 'kworker/1:1H', 'username': 'root'} |
| 175 | + {'pid': 374, 'name': 'kworker/0:2', 'username': 'root'} |
| 176 | + {'pid': 377, 'name': 'kworker/0:1H', 'username': 'root'} |
| 177 | + {'pid': 381, 'name': 'kworker/0:3', 'username': 'root'} |
| 178 | + {'pid': 383, 'name': 'kworker/0:4', 'username': 'root'} |
| 179 | + {'pid': 395, 'name': 'iscsi_eh', 'username': 'root'} |
| 180 | + {'pid': 401, 'name': 'systemd-journald', 'username': 'root'} |
| 181 | + {'pid': 404, 'name': 'ib_addr', 'username': 'root'} |
| 182 | + {'pid': 407, 'name': 'ib_mcast', 'username': 'root'} |
| 183 | + {'pid': 408, 'name': 'ib_nl_sa_wq', 'username': 'root'} |
| 184 | + {'pid': 409, 'name': 'ib_cm', 'username': 'root'} |
| 185 | + {'pid': 412, 'name': 'iw_cm_wq', 'username': 'root'} |
| 186 | + {'pid': 413, 'name': 'rdma_cm', 'username': 'root'} |
| 187 | + {'pid': 416, 'name': 'kauditd', 'username': 'root'} |
| 188 | + {'pid': 429, 'name': 'lvmetad', 'username': 'root'} |
| 189 | + {'pid': 463, 'name': 'systemd-udevd', 'username': 'root'} |
| 190 | + {'pid': 490, 'name': 'kworker/1:3', 'username': 'root'} |
| 191 | + {'pid': 550, 'name': 'iprt-VBoxWQueue', 'username': 'root'} |
| 192 | + {'pid': 982, 'name': 'dhclient', 'username': 'root'} |
| 193 | + {'pid': 1123, 'name': 'iscsid', 'username': 'root'} |
| 194 | + {'pid': 1124, 'name': 'iscsid', 'username': 'root'} |
| 195 | + {'pid': 1128, 'name': 'dbus-daemon', 'username': 'messagebus'} |
| 196 | + {'pid': 1130, 'name': 'atd', 'username': 'root'} |
| 197 | + {'pid': 1132, 'name': 'cron', 'username': 'root'} |
| 198 | + {'pid': 1134, 'name': 'systemd-logind', 'username': 'root'} |
| 199 | + {'pid': 1138, 'name': 'acpid', 'username': 'root'} |
| 200 | + {'pid': 1145, 'name': 'lxcfs', 'username': 'root'} |
| 201 | + {'pid': 1147, 'name': 'rsyslogd', 'username': 'syslog'} |
| 202 | + {'pid': 1158, 'name': 'dockerd', 'username': 'root'} |
| 203 | + {'pid': 1160, 'name': 'accounts-daemon', 'username': 'root'} |
| 204 | + {'pid': 1167, 'name': 'snapd', 'username': 'root'} |
| 205 | + {'pid': 1170, 'name': 'sshd', 'username': 'root'} |
| 206 | + {'pid': 1242, 'name': 'mdadm', 'username': 'root'} |
| 207 | + {'pid': 1252, 'name': 'agetty', 'username': 'root'} |
| 208 | + {'pid': 1253, 'name': 'agetty', 'username': 'root'} |
| 209 | + {'pid': 1262, 'name': 'irqbalance', 'username': 'root'} |
| 210 | + {'pid': 1278, 'name': 'VBoxService', 'username': 'root'} |
| 211 | + {'pid': 1287, 'name': 'polkitd', 'username': 'root'} |
| 212 | + {'pid': 1300, 'name': 'systemd', 'username': 'vagrant'} |
| 213 | + {'pid': 1304, 'name': '(sd-pam)', 'username': 'vagrant'} |
| 214 | + {'pid': 1544, 'name': 'dhclient', 'username': 'root'} |
| 215 | + {'pid': 1584, 'name': 'docker-containerd', 'username': 'root'} |
| 216 | + {'pid': 1982, 'name': 'sshd', 'username': 'root'} |
| 217 | + {'pid': 2013, 'name': 'sshd', 'username': 'vagrant'} |
| 218 | + {'pid': 2014, 'name': 'bash', 'username': 'vagrant'} |
| 219 | + {'pid': 2046, 'name': 'python3', 'username': 'vagrant'} |
| 220 | + ``` |
| 221 | + |
| 222 | + |
| 223 | + |
| 224 | +# Releases |
| 225 | + |
| 226 | + |
| 227 | +# License |
| 228 | +Read [License](https://github.com/Tech-Overlord/system-info/blob/master/LICENSE). |
| 229 | + |
| 230 | +NOTE: Currently in development phase! |
0 commit comments