| 186 | | ... TODO ... |
| | 186 | Configuring NRPE is a bit more involved but not overly so. |
| | 187 | The first thing you need to do to get things working is add the NRPEListener module. |
| | 188 | {{{ |
| | 189 | [modules] |
| | 190 | ... |
| | 191 | NRPEListener.dll |
| | 192 | ... |
| | 193 | }}} |
| | 194 | If you have not already done so (above) you also need to set which computers are allowed to query the agent. |
| | 195 | This is set either under the [Settings] section (globally) or under the [NRPE] section (locally). If you when you configured NSClient above set this globally you are already set to go. If not the key you need to change is the allowed_hosts. There is no password for NRPE. |
| | 196 | - allowed_hosts = A list of addresses that is allowed to ask questions (ie. your nagios ip). |
| | 197 | The result should look like this (assuming your nagios server ip address is 10.0.0.2): |
| | 198 | {{{ |
| | 199 | [Settings] |
| | 200 | allowed_hosts=10.0.0.2 |
| | 201 | }}} |
| | 202 | '''After this restart the service.''' |
| | 203 | {{{ |
| | 204 | nsclient++ /stop |
| | 205 | nsclient++ /start |
| | 206 | ... or ... |
| | 207 | net stop nsclientpp |
| | 208 | net start nsclientpp |
| | 209 | }}} |
| | 210 | |
| | 211 | |
| | 212 | Now feel free to try the command line agent again and hopefully things should work out perfectly. |
| | 213 | Run the following command from your nagios server. |
| | 214 | {{{ |
| | 215 | ./check_nrpe -H 10.0.0.1 |
| | 216 | I (0.3.3.19 2008-07-02) seem to be doing fine... |
| | 217 | }}} |
| | 218 | |
| | 219 | === Finding and solving problems === |
| | 220 | A good way to find and solve problems is to run nsclient++ in "test" mode this is done by stopping the service and starting it in "test" mode. |
| | 221 | {{{ |
| | 222 | nsclient++ /stop |
| | 223 | nsclient++ /test |
| | 224 | ... test mode ... (quite with: exit) |
| | 225 | nsclient++ /start |
| | 226 | }}} |
| | 227 | When in test mode you will get a lot of interesting log messages when things are happening so it is fairly simple to figure out what is wrong. |
| | 228 | |
| | 229 | === NSClient++ configuration (revisited) === |
| | 230 | As we said before it is a bit more involved to configure NRPE and yet thus far it has actually been simpler? |
| | 231 | This is because we have not configured things yet NRPE has a few more keys and I shall go over the most important once here: |
| | 232 | - use_ssl Boolean |
| | 233 | If this is 1 (true) we will use SSL encryption when communicating. '''Notice''' this flag has to be the same on both ends or you will end up with strange errors. The flag is set on check_nrpe with the -n option (if you use -n no SSL will be used). |
| | 234 | - allow_arguments |
| | 235 | Since arguments can be potentially dangerous (it allows your users to controll the execution) there is a flag (which defaults to off) to enable arguments. So if you plan on control NSClient++ from the nagios end you need to enable this. '''But be warned this is a security issue you need to think about'''. If you do not want to allow arguments you can instead configure all checks in the NSC.ini file and just execute the aliases from nagios. |
| | 236 | - allow_nasty_meta_chars |
| | 237 | This flag allows arguments to contain "dangerous" characters such as redirection and pipe (<>|) and makes things a tad more dangerous. But if you decide to use arguments you most likely want to use this flag as well. '''But again this is a security risk''' |
| | 238 | |
| | 239 | === using from the command line (revisited) === |
| | 240 | Now that we have the agent up and running (if not probably want to go back over the previous sections to get it up and running before reading on) what can we do with it?. From here on we will assume you have allow arguments and metchars enabled since it makes it simpler to try things out. |
| | 241 | As we stated before check_nrpe is a lot more powerful then the "old" check_nt and there is a lot of built in commands as well as a lot of external once you can use. The built in once are listed below. |
| | 242 | [[ListTagged(check)]] |
| | 243 | Lets start with a simple one [CheckCPU] and see how to use it. |
| | 244 | |
| | 245 | If we check the docs for it it has an example like so: |
| | 246 | {{{ |
| | 247 | checkCPU warn=80 crit=90 time=20m time=10s time=4 |
| | 248 | CPU Load ok.|'20m average'=11%;80;90; '10s average'=7%;80;90; '4 average'=10%;80;90; |
| | 249 | }}} |
| | 250 | Now this is a "NSCLient++ /test mode command" so it is not usable in it self for you instead you need to change it slightly. |
| | 251 | The first word is the command and the rest are arguments. |
| | 252 | check_nrpe has two options for settings commands (-c) and arguments (-a) and is used like so: |
| | 253 | {{{ |
| | 254 | check_nrpe ... -c <command> [-a <argument> <argument> <argument>] |
| | 255 | }}} |
| | 256 | in this case (CheckCPU) this translates to: |
| | 257 | {{{ |
| | 258 | check_nrpe ... -c CheckCPU -a <the argument list as-is> |
| | 259 | check_nrpe ... -c CheckCPU -a warn=80 crit=90 time=20m time=10s time=4 |
| | 260 | CPU Load ok.|'20m average'=11%;80;90; '10s average'=7%;80;90; '4 average'=10%;80;90; |
| | 261 | }}} |
| | 262 | And that is as hard as it gets all you need to do is figure out which arguments you want to use for the command and stack them all in a long line. |